3
在IE中,当我试图读取本地XML文件时,JQuery给了我一个parseError。希望有人能够发现它。代码在FF工作正常本地xml文件IE浏览器JQuery ajax parseerror
jQuery的问题
$.ajax({
type: "GET",
url: settings.PresentationLocation,
dataType: "xml",
async: false,
contentType : 'application/xml',
success: function(xml){
//Setup the slides
$(xml).find('slide').each(function(){
//Create the slide
obj.append('<div class="slide"><div class="slideTitle">'+ $(this).find('title').text() +'</div><div class="slideContent">'+ $(this).find('content').text() +'</div></div>');
});
totalSlides = obj.children('.slide').size();
//Hide all the slides
obj.children('.slide').hide();
},
error: function(xmlReq, status, errorMsg){
console.log("Error Message: "+ errorMsg);
console.log("Status: "+ status);
console.log(xmlReq.responseText);
throw(errorMsg);
}
});
XML文件
<?xml version="1.0" encoding="UTF-8"?>
<slides>
<slide>
<title>Slide 3</title>
<content>Hi there</content>
</slide>
</slides>
语法对我来说很好。你在ie8中使用开发人员工具测试了这个吗?对它给你的错误有更多具体细节?如果您不能在那里放置断点,我会添加警报,以便您可以准确查看错误的位置。 – wajiw 2010-12-13 23:12:30