Ajax Through My Eyes

I swore to myself a while ago that I wouldn’t write anything about Ajax, but I’m about to break this promise, mostly due to writing like this, and other various bits from around the web that quite simply just don’t appear to make any sense. So here are my thoughts, which are based on theories untested and mysteries unsolved.

First off, what is Ajax? Well, despite the capitalization, it’s an acronym coined in an Adaptive Path article written over a year ago, after Google released GMail and everyone started diving into their javascript source code to figure out how they did all that fancy page refresh stuff. It stands for “Asynchronous JavaScript + XML”, which is somewhat misleading for reasons explained later.

At the core of Ajax is one simple little javascript object called XMLHttpRequest. Peruse the article from Apple in the link I just provided. It describes the history of the object, it’s methods (or messages, Vlad), properties, and has some small examples on its usage. Passing the article through Jeff’s Super Information Condenser produces the following output:

  • XMLHttpRequest has been around for many years, first in Microsoft’s IE as an Active-X object.
  • The object is now supported in some form by all major browsers in use today, with some quirks.
  • There are two methods of interest. open(), which prepares a connection to a URL, and send(), which makes a request asynchronously (most of the time) to the URL.
  • There are a few properties of interest as well, namely onreadystatechange (an event handler you pass a function to), readyState (the current state of the object), and responseText (which is the actual response returned by the request to an URL)

Passing the condensed information through Jeff’s Even Superer Information Condenser, we end up with this:

At the core of Ajax is javascript’s XMLHttpRequest object, which lets you make and manage asynchronous requests to a server.

Notice how my Information Condenser says XMLHttpRequest is “At the core of Ajax.” So what else is Ajax comprised of, you may be asking yourself? Well, to answer that question, you’ll have to go back and re-read the Adaptive Path article I linked to above. If you want my version (which I’ll assume you do, because I’m like that), here goes: No one fucking knows.

My take on Ajax is basically that Ajax means using XMLHttpRequest to get information from a remote URL without doing a full page refresh. Exhilarating, eh? Which kind of makes me wonder why we have full on “Ajax frameworks” like Atlas, replete with special updatePanels and Control Toolkits. I personally fail to see why it needs to get so damn complicated. Maybe it’s time to play around with it a little bit to see what the big deal is.