Slight nightmare. This works in every browser except IE in compatibil开发者_运维百科ity mode and IE6.
I've searched and searched and have no clue to why, can anyone shed any light?
$(document).ready(function () {
$.ajax({
type: "GET",
url: "/Maps/MapResults.aspx",
dataType: "XML",
success: function (asd) {
//This works!
alert(asd);
//This doesn't! (in old IE)
$(asd).find("article").each(function () {
var category = $(this).find('category').text();
alert(category);
});
}
}); //close $.ajax(
});
Let MapResults.aspx send and XML-Content-Type-Header (e.g. application/xml) . Also use lowercase-dataType "xml", it may depend on jQuery-Version if dataType is case-sensitive(I'm not 100% sure, but i think it was case-sensitive before 1.5)
精彩评论