saving querys in an ajax way to the server