Switched from AJAX to using socket.io