Ajax stands for Asyncronous Java Script and XML and is known for making web applications function as fast (or faster) than desktop applications. Let’s talk about what a typical web application looks like. For instance, a Google search:
* you enter some text in the search box.
* you then click the search button.
* the page is refreshed and you get results backs.
* this entire process could take a few seconds to minutes depending on how much data you’ve requested, the load on the webserver, your internet connection and so on.
* in short, it is a pretty quick process, but it can be quicker…
So how can AJAX improve something like a Google search. Using the previous example above:
* you enter the same text into the search box, however now your results are returned instantly as you’re typing!
That’s the power of AJAX, instant data is returned without having to click submit and waiting for the screen to refresh. So, that’s the end result of an AJAX enabled website, instant data is returned based on the letters you are typing (as in our AJAX Google search example).
Technically speaking, this is how AJAX is working in the background:
1. A webpage executes some Java Script that can grab data from a web server as it’s needed.
2. If more data is needed Java Script invokes an object called XMLHttpRequest. This object transparently and instantly retrieves data then presents it without having to refresh the browser.
3. The data that’s returned is usually XML. This XML can easily be formatted using HTML and CSS.
Keep in mind that those 3 steps above happen instantly! If you want a real world example of AJAX in action just start to do a Google search. Those results that drop down as you’re typing are the results of Ajax!