Send ajax request to server for saving the query