Saturday December 11, 2004
XmlHttpRequest
Dave quotes it, Charles writes it. XmlHttpRequest is the topic at hand and how it will help us build the next generation of web UIs. I've used Brent Ashley's JSRS Library to do some fancy UI work (one drop-down populates another) last year. It worked well in combination with Erik Hatcher's articles: Remote scripting using a servlet and Sending rich messages between client and server using asynchronous messaging. The project was AppFuse based, so I have the code if someone really wants it.
An example of XmlHttpRequest is in Roller itself - in the twisty comments you see on this site. For those who have used them, you probably know they're somewhat buggy. With all this talk of XmlHttpRequest, maybe it's high-time to revisit Roller's implemenentation and see if the technology has gotten any better. In reality, I know it hasn't - it's the browsers that are the problem and there hasn't been an update to IE in quite some time. My code could probably use some work though. If you want to dig in and check it out, here's the xmlextras.js that does the heavy lifting and comment-specific JavaScript.
After looking at this code this morning, it looks like there's different methods being used for the different browsers.
/////////////////////////////////////////////////////////////////////
//// XML Document loading
function loadXMLDocument(aURL, aCallback)
{
gMediaCallback = aCallback;
if (window.ActiveXObject) {
// Internet Explorer XML loading syntax
gMediaDoc = new ActiveXObject(getControlPrefix() + ".XmlDom");
gMediaDoc.onreadystatechange = onMediaReadyStateChange;
gMediaDoc.async = true;
gMediaDoc.load(aURL);
} else {
// Mozilla XML loading syntax
gMediaDoc = document.implementation.createDocument("", "", null);
var xmlHttp = new XMLHttpRequest();
xmlHttp.overrideMimeType("text/xml");
xmlHttp.open("GET", aURL, false);
xmlHttp.send(null);
gMediaDoc.loadXML(xmlHttp.responseXML.xml);
onMediaLoaded();
}
}
I wonder if there's a common way that can be used for both browsers? BTW, 99% of the code for these comments was borrowed from Joe Hewitt.
Later: Another article covering this technology: Using the XML HTTP Request object. Hat tip to Carl.
Posted in Roller
at Dec 11 2004, 09:29:09 AM MST
13 Comments
Search This Site
Recent Entries
- Raible Road Trip #13
- The good ol' Job Hunt
- How to use GWT 2.0 with Maven and Generate SOYC Reports
- JSON Parsing with JavaScript Overlay Types in GWT
- A Fun Father's Day at Great Sand Dunes
- Going to the Great Sand Dunes for Father's Day
- Implementing OAuth with GWT
- Enhancing Evite.com with GWT and Grails
- 2nd Row at Red Rocks and Elephant Rock Ride
- Creating a Facebook-style Autocomplete with GWT