Due to the glacial pace of web standards, it’s not often that you get to add a new trick to your repertoire. However, thanks primarily to Google, it appears that the old request-response model of web applications can finally fade into the past. It’s not that they have invented a new technology, just that they’ve actually made use of a long-dormant piece of JavaScript, and by doing so, give other web developers a finger to point at when wary bosses question the tactic.
Wary Boss: I don’t know, it seems pretty advanced.
Developer: Not really, all the major browsers support it.
Wary Boss: I don’t know…
Developer: Google uses it.
Wary Boss: Well, if Google uses it then it must be OK.
This under-used piece of JavaScript is called XMLHttpRequest, and it allows you to execute a HTTP request, and process the response without reloading the page.
Thankfully, my boss is highly technical, and when I proved that it would work in Safari (he’s a huge mac fan) he had no problem with using this technique. It’s truly amazing to see pages have real-time responses to user input. So far, we only use it for doing a quick check to see if a requested user name exists or not, but the potential uses of this are unlimited. Google uses it extensively in gmail and Google Suggest. Flickr uses it as well, and if you develop web applications, so should you.
References:
March 2nd, 2005 at 6:05 am
Most of the articles out there only talk about using the request.requestText function. I’ve put together some javascripts that use the sample code from Apple and others, but allow more flexible use of the whole XML enchilada.
Article here:
http://www.topfunky.net/cgi-local/article.pl/124