You are hereBlogs / Matt's blog / jQuery Ajax Requests on IE6 Need Extra Help To Parse
jQuery Ajax Requests on IE6 Need Extra Help To Parse
Using jQuery's .get .post or .ajax features to parse xml results, you may find that only Internet Explorer 6 fails to parse your xml result in the callback function. You can always count on your friend IE6 to crush productivity!
But before you try this, particularly in newer versions of jQuery, be very sure your XML is well formed and sent with a Content-type: text/xml header. Either of those situations are more common than we'd like to think. A firefox extension like Firebug is absolutely critical for figuring out whether or not you have problems from spurious php warnings/notices/etc goofing up IE's xml parsing. Firefox, correctly in my view, ignores script generated errors.
A solution to try if you're stuck with an older jQuery and at your wit's end:
.post("/url",{ "data":vals },
function(xml) {
// Force IE6 to parse the XML:
if (jQuery.browser.msie) {
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.loadXML(xml);
xml = xmlDoc;
}
// Do whatever you need to do here...
}
// Be sure to override the default 'xml' in IE and force it as text
,(jQuery.browser.msie) ? "text" : "xml");
Hopefully that saves someone else time.