Solution:3

You can't perform a query to a database with JS or anything alike, AJAX is nothing but an user experience ilusion, even when we can speak of "fetching DB records through AJAX" that's not actually what's happening.

If AJAX is just more JavaScript (Asynchronus JS, that is, happening in it's own "timeline" / thread, not the main one) then that would mean that fetching data from a DB (or doing anything through AJAX for that matter) would be the same as having a link to scripts that statically do that, meaning, you click here, you're taken to a page that fetches (server side) and displays (client side) the information.

Now imagine that you just do exactly that, but instead of taking your main thread to that action, you fire an asynchronus thread (that will work just as any other link, for instance) which will post/get data and get an X response, which you can handle through JS later on, thus, giving you the ilusion of "real time queryes".

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com