Jquery ajax错误回调";“readyState”:4、“;“地位”:404
我对一个xml文件调用了ajax jquery:Jquery ajax错误回调";“readyState”:4、“;“地位”:404,jquery,ajax,xml,Jquery,Ajax,Xml,我对一个xml文件调用了ajax jquery: $(document).ready(function(){ $.ajax({ type: "GET", url: "mydata.xml", dataType: "xml", success: function(xml) { //myfunct }, error: function(xhr,textStatus,err) {
$(document).ready(function(){
$.ajax({ type: "GET",
url: "mydata.xml",
dataType: "xml",
success: function(xml) {
//myfunct
},
error: function(xhr,textStatus,err) {
alert("readyState: " + xhr.readyState);
alert("responseText: "+ xhr.responseText);
alert("status: " + xhr.status);
alert("text status: " + textStatus);
alert("error: " + err);}
});
});
mydata.xml位于.js和.html文件的同一文件夹中。
当我用chrome打开.html时,警报显示:
readyState: "4"
responseText: ""
status: "404"
text status: "error"
error: ""
我需要找出ajax调用未能成功加载xml文件的原因
谢谢检查通过AJAX请求的URL(例如在控制台中),然后尝试在浏览器中手动请求。服务器似乎找不到该资源。