XmlHttpRequest – blast from the past or future

In several places XMLHttpRequest sprung up this week. XmlHttpRequest is a JavaScript object allowing browser clients to communicate with a server without refreshing the current page. This object originated from Microsoft, implemented as an ActiveX object. But other browser including mozilla are also supporting it now. Amis already built an application using this technology way back in 1999. The guys who developed that system have proven to be quite visionary. The way they built is exactly what Duncan Mills describes in his commentary on a TSSS presentation.

the use of XmlHttpRequest to communicate with the server asynchronously in the background, and populating the page by manipulating the DOM tree. So the page can be updated without refreshing the whole page, giving you things like instant validation and really dynamic screens..

They took it even a step further in creating a behavior (htc file) which they attached to HTML tables. In this way the tables act like multi record blocks in Oracle Forms. The table remains in place and only data change, complete with scrolling. Really cool. Changes in data are cached in an XML object clientside until the save button is pressed. The records are then posted to the server again using the XMLHttpRequest. There the posted XML is handled by a generic “XML to Table data converter”.

Now that it has become mainstream I can see a lot of good uses for it. Indeed validation, dynamic screens but also for example coordinated select list and “smart forms” (completion of entered values). An excellent little example and great introductory tutorial on XmlServletRequest can be found here
It shows how based on a zip code, city and state are filled in in the onblur event of the zip code textfield
Javascript is much more powerfull this way, it can call webservice, query a database etcetera. It’s is not tied in with any serverside language. You can use any language you want, PHP,CGI,Java.

Interestingly enough the response to an XmlHttpRequest does not have to be XML …

8 thoughts on “XmlHttpRequest – blast from the past or future

  1. I think an essay titled “Ajax: A New Approach to Web Applications” by Jesse James Garrett February 18, 2005 provides a good overview of where developments currently are. Find this essay at http://www.adaptivepath.com/publications/essays/archives/000385.php. Especially the following image from this essay seems enlightening:. It does also remind me of Oracle’s Project Cherokee… a JavaScript render engine driven by the server side Model.

    I feel that AJAX and the XMLHttpRequest makes sense for a smaller set of functionality: the bulk of the webpages will continue to be generated by JSPs. However, validation, conditional population of select-items, step-by-step build up of a tree (navigator), refresh of the contents of a table (re-sort, next range-set), etc. will allow for a seemingly more dynamic, more responsive HTML user interface.

  2. Gmail current tells you that your username password combination is incorrect without reloading the page. It is very refreshing.

  3. I suppose the real news is that both of the two big browsers are supporting it and that some big players are starting to use it. This means defacto standard coming up and any browser that want to be anything in the future is going to have to support it.

Comments are closed.

Next Post

Bring in the decorators - SiteMesh!

There are several approaches to keep a consistent look and feel for your web application. Lots of times the site will contain a navigation bar, a heading maybe a footer. Of course you can do this using frames or jsp includes. Well frames are probably a thing of the past. […]
%d bloggers like this: