So many times I have seen and heard people speak of AJAX like it were a programming language. I have heard people who know nothing about computer programming, and I have heard programmers say it. It seemed like for a few years everyone was talking about AJAX, and I guess to some point people still are. Perhaps now people are just taking it for granted.
Well AJAX is not a language, in fact it’s not even really a technology, it is more like a technique. AJAX stands for Asynchronous Javascript And XML. What it does is give the ability for web applications to behave more like desktop apps rather than the page reloading after each click.
The first application that extensively used AJAX was GMail, it revolutioned the way that web apps looked and functioned. So how does AJAX work? First a few things that you will need to know about Javascript.
Javascript is run in the browser, meaning that it is not run on the server, so when javascript executes it will change the appearance of the webpage without a request to the server. For the most part it was used to change images when you hovered over them, and change text when a button was clicked. Nothing particularly powerful, it really seemed more like a toy. It gives the programmer the ability to change different properties of the HTML on the fly. So if you have something along the lines of <h1 id=”myHeadline”>The Headline</h1> you can access the element by its ID and change the style or even the inner content.
So for instance document.getElementById(“myHeadline”).innerHTML = “New Heading” would change the “The Headline” to “New Heading”. The ability to alter there elements without contacting the server was useful but it didn’t have much power.
What has happened now is the ability of the browser to make a background request back to the web server to fetch some data. This is all done with javascript. The javascript will then update the page without reloading it. This gives the look and feel of the desktop app.
Because of this type of behavior javascript has become a very important part of common webpages. You now see that browsers base their speed ratings very much along the lines of their javascript engine. These new fangled sites speed to operate. How long it takes to open an email in gmail, load more comments on digg are dependent on how fast the javascript engine is in your browser.