Rhinestic's Knick Knacks

Wednesday, March 31, 2010

jQuery handles XML weirdly...

After lots of trying, and sourcing around (thanks to Mike), and meddling around, finally got something that works:


$.ajax({
type: "GET",
url: xmlName,
dataType: ($.browser.msie) ? "text" : "xml",
complete: function(data,status){
if (status="success"){
var xml;
if ($.browser.msie){
//alert("true");
xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
xml.loadXML(data.responseText);
} else {
xml = data.responseText;
}

//can start traversing xml here

}
}
});



Oh, another thing to note: Don't try to use image as a tag in the xml. It won't work in HTML.

No comments :

Related Posts Plugin for WordPress, Blogger...