Short history of XmlHttpRequest
The XmlHttpRequest object is more an HTTP Request object, since its payload isn't limited to an XML document. Articles have sprung up over the last year about using this object as a means of seamless client side form validation which includes server-side lookups and checks.
The development only took a few hours over two weekends. I initially had a problem diagnosing where problems were occurring, and eventually tracked it down to a bug in my PHP server side implementation. The second problem I had was using DOM to create the relevant XML for an entry - for some reason, all the elements came out in uppercase. So I've had to hack a string builder method until I find the simple way out of it (which largely lies in consulting the right documentation).
document.formname, Interner Explorer's error correction allows developers to reference it also as
formname thus clobbering any variable using that name.
One piece of the application is listing all the entries in an Atom feed. This listing is done by dynamically generating an HTML list and inserting it directly into the visible document. Mozilla did this without a problem, and allowed me to create a list of links all with the
onclick event handler. Internet Explorer, on the other hand, refused point blank, to notice the dynamic onclick event. So I had to create the links using
The last Internet Explorer problem was its caching. IE caches the XML documents returned from an XmlHttpRequest. So when an author creates and saves a new blog entry, the blog list URL is re-requested, but the cache interferes sending back the original feed list without the new blog entry. I've worked around this by inserting a timestamp in the query string of every get request - that way it forces IE to ignore the cache.
The source code for this client is available in a zip file.
Update 13 May 2004: Ned Baldessin writes in to say that Safari now handles the XMLHTTPRequest object just like Mozilla. Fantastic stuff - hopefully that feature is backported to Konqueror - that would leave Opera as the only browser not yet supporting this feature.
Update 10 June 2004: Mendrik writes in with a possible solution for Opera. Using Java's liveConnect in Opera allows exchanging of XML documents. He has an example page up. Quick test in Opera 7.20 worked.
- Jim Ley: Using the XML HTTP Request object
- XulPlanet: XMLHttpRequest reference
- 15 seconds: Client side validation using the XMLHTTPRequest object
- msdn: XMLHTTPRequest
- msdn: IXMLHTTPRequest Members
- AtomWiki: Carrot vs Orange