What the _ Is Ajax? And Why Give A _??

Interesting blog posting on web technology from Greg Penhaligon at Download.com.  No introduction needed.  Read on.

Keep Web Pages Clean with Ajax
Thursday November 17th, 2005
http://blogs.download.com/Code-Monkey/

You’ve heard the sound. Maybe you’ve even made it yourself. It’s the sound someone makes when they encounter an Ajax-driven Web page for the first time. It sounds like this:

"Oooooooh."

Don’t know what I’m talking about? Lets visit Google Suggest for an example. Let’s search for info on one of my favorite hobbies, cantaloupe art. Go ahead and start typing: "c-a-n-t-a-"…Oooooooh!

That’s Ajax.

So how does it work? Like many new things on the Web, Ajax is actually made up of old technologies – namely JavaScript and XML (Ajax stands for Asynchronous JavaScript language and XML). What’s new about Ajax is the way these technologies are being utilized to deliver a more seamless user experience.

To really understand Ajax, let’s first take a look at the old model for Web-based interactivity: a user interacts with a Web page; the page makes an http request to the Web server; the server processes the requested information and delivers it in the form of a new Web page. This is why Web applications have always sucked; every time you want to do something you need to wait for a whole new page to be delivered.

Now, with Ajax, or more specifically with the XMLHttpRequest object, a Web application can retrieve data from the server in the background, asynchronously, without having to reload the page. The result of this background communication is a Web application that performs more like a desktop application.

My favorite Ajax-fueled application is the new beta version of Yahoo Mail. Previously, everything you clicked in Yahoo Mail required the page to reload (just like Hotmail or any other Web-based app). In the new beta version, not only does Yahoo Mail look just like Microsoft Outlook, but it performs like Outlook: you can open messages, drag them to the trash, even check your spelling, all without reloading the page. Gmail works on the same principle, as does Google Maps and a load of other sites.

Now, if your thinking "Huh, if they can make Web-based email function more like a desktop application, then why couldn’t they replicate the functionality of other desktop applications on the Web?", then, well, you’re about six months behind Microsoft, but you’re still pretty smart in my book. As we speak, developers in Redmond are working on Ajax-driven versions of all their popular Office applications.

And they’re not just talking about replacing client applications; they’re talking about making the Web-based apps better than their desktop counterparts. For starters, because they’re Web-based, they’ll all be cross-platform compatible. They won’t take up any space on your hard drive, leaving more room for your, um, music collection (that is music, isn’t it?). You’ll never lose a file again because all your files will be stored remotely, just like your email. And here’s the best part: they’d be free, albeit with some advertising thrown in next to your spreadsheet.

Ajax is even turning up in online advertising: I was surfing around not more than a minute ago, doing some research for this piece, and there, at the bottom of an ad for Wendy’s new Bacon Mushroom Melt, was a little box for you to enter your zip code and locate the Wendy’s nearest you. Since I’d skipped lunch today I went ahead and entered my zip code, clicked the Go button, and before I could even anticipate the page reloading, up popped the addresses for two Wendy’s locations in my neighborhood, right there inside the ad. Now that’s progress.

As complex as all of this looks, the trick to making data transfers happen asynchronously is really not that difficult. If you’d like to try it out for yourself (and you really should, because there’s going to be a huge demand for Ajax developers in the coming months), I’d point you to Paul Adam’s great XMLHttpRequest tutorial All Request, All The Time on Webmonkey (yes, Webmonkey is back; whoo hoo!).

Sorry for the big delay between postings, by the way. Do you know they actually expect me to do other work around here besides my blog? I mean, whatever. Anyway, you can look forward to more frequent postings in the future.

Advertisements