Dont call it Ajax, Please

Recently the computer industry, in particular, the web programming realm, has seen the rise of technology called Ajax. Its actually quite funny, because all this “new” technology is, is a combination of existing technologies that have been around since the late 90s. So to call Ajax new is technically incorrect, it is simply a new way to use these technologies. This is the same set of ideas that were behind DHTML that was used by websites in the mid 90s: use existing technologies together to create new effects on a website to enhance the user experience.

DHTML really is nothing but a combination of Javascript and CSS. Javascript doing what it does best – manipulate the DOM with CSS to generate effects that make the page more interactive to the user. But DHTML is, like Ajax, not a new technology, it was simply a new way to use existing technologies. Ajax stands for Asynchronous Javascript and XML, technologies that have been around since the early days of the Internet. Again, we are using Javascript to enact DOM changes on the client side to make the page appear to be more desktop like, which is the final goal for any webapps – to function on the web as a desktop app functions on the desktop.

What really bothers me is, people who call simple DOM manipulation, such as hiding elements on the fly with display: none and show elements with display = “”. This is not Ajax, this is Ajax:

// setup the request object – if we can
var request;
try {
request = new XMLHttpRequest();
}
catch (error) {
try {
request = new ActiveXObject( “Microsoft.XMLHTTP” );
} catch (error) {
return true;
}
}

// open the request and be prepared to handle the response, it exists
request.open( ‘get’, url, true );
request.onreadystatechange = function() {
if ( request.readyState == 1 ) {
simplexhr.loading();
}

if ( request.readyState == 4 ) {
simplexhr.complete();
if ( /200|304/.test( request.status ) ) {
simplexhr.retrieved( request );
}
else {
simplexhr.failed( request );
}
}
}

// send
request.send( null );
return false; // this ensures that the link is not followed ()

DOM manipulation has been something Javascript has been able to do for years, something it was designed to do. I even question half of Microsoft Ajax Atlas Controls as to whether they are really Ajax, but rather simple encapsulations of DOM manipulation with underlying JS logic. To me, Ajax is about going out to a server and getting XML to manipulate. Nowhere in the acronym do we talk about DOM manipulation as being part of it. This is basically DHTML not Ajax. DOM manipulation is certainly an integral part of the Ajax process as it allows you put the data into the page – but this is DOM Scripting not Ajax.

Just a rant and my two cents – have fun coding 🙂

Advertisements

One thought on “Dont call it Ajax, Please

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s