Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery ajax错误回调";“readyState”:4、“;“地位”:404_Jquery_Ajax_Xml - Fatal编程技术网

Jquery ajax错误回调";“readyState”:4、“;“地位”:404

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) {

我对一个xml文件调用了ajax jquery:

$(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(例如在控制台中),然后尝试在浏览器中手动请求。服务器似乎找不到该资源。