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 …
But be aware, there may be more going on than you know. Look at this article called “Using the XMLHttpRequest Object and AJAX to Spy On You” (http://www.devx.com/webdev/Article/28861).
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.
Gmail current tells you that your username password combination is incorrect without reloading the page. It is very refreshing.
One fascinating application of this is a login system without the traditional page refresh.
http://www.jamesdam.com/ajax_login/login.html
I can’t wait to see XMLHttpRequest in action more often redefining the traditional web interface.
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.
isn’t this what google suggest is doing? http://www.googlemania.com/noticias.php?1070&Google+Suggest+Dissected
I had seen one great search engine script which works using this method but cant remember it now 🙁
Some live examples here – http://www.fiftyfoureleven.com/resources/programming/xmlhttprequest/examples
cheers
Ravi
I found an interesting introduction to the XMLHttpRequestObject at Dynamic HTML and XML: The XMLHttpRequest Object (5th December 2004)