I never worked with ajax.
I need to know if it is possible to use ajax to run a query on the db (sql server 2005).
My target is to run a query with refreshin
Directly, no. And that is a very good thing, since the JavaScript is generally running on an untrusted machine.
But it should be pretty easy to have your AJAX fire off a callback (e.g. a post) and then have that do the query on the server side.