PHP/ajax implementation of Chainshot