got server and js to communicate using json for ajax queries