added ajax to communicate with server