ie无法使用jquery解析xml
$.ajax({
url:”codArea.xml”,
type: “GET”,
dataType: “xml”,
error: function(xml){
alert(‘Error loading XML document’+xml);
},
success: function(xml){
$(xml).find(“pName”).each(function(i){
$(“#province”).append(“<option id=”+i+”>”+$(this).text()+”</option>”);
});
}
});
[/javascript]
$.ajax({
url:”codArea.xml”,
type: “GET”,
dataType: ($.browser.msie) ? “text” : “xml”,
error: function(xml){
alert(‘Error loading XML document’+xml);
},
success: function(data){
var xml;
if (typeof data == “string”) {
xml = new ActiveXObject(“Microsoft.XMLDOM”);
xml.async = false;
xml.loadXML(data);
} else {
xml = data;
};
$(xml).find(“pName”).each(function(i){
$(“#province”).append(“<option id=”+i+”>”+$(this).text()+”</option>”);
});
}
});
[/javascript]