Ajax (no, the other one)

No, the PC isn’t talking the household cleaning product. Fair warning: the geek verbage below is quite heavy.

Ajax is short for Asynchronous Javascript and XML. It isn’t a technology in itself, but a reference to a group of technologies being used together. It uses HTML (XHTML) and CSS for content presentation, the DOM and Javascript to process user interactions with the content, and XMLHttpRequest or something similar (essentially any pain text format) to exchange information asynchronously with the server.

The important thing here is “asynchronous”. Web pages typically only return more information to the user by means of a page request - you click a map, the request goes to the server, and the server spits back an entirely new page. In an asynchronous transaction, you interact with the page, and the page requests information from the web server without making a new page request. You could return a new map or page forward in a data grid while the rest of the page sits there smiling at you.

The advantage of Ajax is data can be manipulated without having to return the whole page, making responses to the user faster and lowering network and server overhead by not having to send back unchanged information. Some of the disadvantages of Ajax is it tends to disable the browser back button (it records page history, and your page won’t have gone anywhere), and it makes it a challenge to bookmark a particular state of the application (though there are some workarounds to both of those items). The user might also be thrown a bit, as the page isn’t reacting as they would normally expect. If network latency is high, be prepared code-wise for some user freak outs and button mashing. And if your principal measure of web traffic is page views, be prepared for some disappointing numbers.

This isn’t new stuff (the PC actually had an Ajax MapObjectsIMS application back in the day), but it’s gaining a lot of popularity, particularly with great new Ajax applications from Google like Google Maps and Gmail. Expect an emphasis on Ajax in .NET 2.0 as well.

The PC tossed together an extraordinarily simple (one might say useless) Ajax example. Check it out at http://maps.co.mecklenburg.nc.us/website/svggis/multiply.php. Form variables are passed to the server and a response is received and put into the form box without ever requesting a new page. It was done using PHP and an open-source Ajax class library.