<bdo id='0UP1h'></bdo><ul id='0UP1h'></ul>
    <i id='0UP1h'><tr id='0UP1h'><dt id='0UP1h'><q id='0UP1h'><span id='0UP1h'><b id='0UP1h'><form id='0UP1h'><ins id='0UP1h'></ins><ul id='0UP1h'></ul><sub id='0UP1h'></sub></form><legend id='0UP1h'></legend><bdo id='0UP1h'><pre id='0UP1h'><center id='0UP1h'></center></pre></bdo></b><th id='0UP1h'></th></span></q></dt></tr></i><div id='0UP1h'><tfoot id='0UP1h'></tfoot><dl id='0UP1h'><fieldset id='0UP1h'></fieldset></dl></div>
      <legend id='0UP1h'><style id='0UP1h'><dir id='0UP1h'><q id='0UP1h'></q></dir></style></legend>

      <small id='0UP1h'></small><noframes id='0UP1h'>

      1. <tfoot id='0UP1h'></tfoot>

        responseXML 始终为空

        时间:2023-10-14
        <legend id='7S5Tf'><style id='7S5Tf'><dir id='7S5Tf'><q id='7S5Tf'></q></dir></style></legend>

            <tbody id='7S5Tf'></tbody>
        • <small id='7S5Tf'></small><noframes id='7S5Tf'>

          • <i id='7S5Tf'><tr id='7S5Tf'><dt id='7S5Tf'><q id='7S5Tf'><span id='7S5Tf'><b id='7S5Tf'><form id='7S5Tf'><ins id='7S5Tf'></ins><ul id='7S5Tf'></ul><sub id='7S5Tf'></sub></form><legend id='7S5Tf'></legend><bdo id='7S5Tf'><pre id='7S5Tf'><center id='7S5Tf'></center></pre></bdo></b><th id='7S5Tf'></th></span></q></dt></tr></i><div id='7S5Tf'><tfoot id='7S5Tf'></tfoot><dl id='7S5Tf'><fieldset id='7S5Tf'></fieldset></dl></div>

              <bdo id='7S5Tf'></bdo><ul id='7S5Tf'></ul>

                <tfoot id='7S5Tf'></tfoot>

                  本文介绍了responseXML 始终为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我用的是firefox 3.6.10,用firebug来调试

                  Im using firefox 3.6.10, and firebug to debug

                  所以,这是我的代码:

                  var xmlhttp = new XMLHttpRequest();
                  xmlhttp.open("GET", url,false);
                  xmlhttp.setRequestHeader('Content-Type',  'text/xml');
                  xmlhttp.send(null);
                  alert(xmlhttp.responseXML);
                  

                  responseXML 始终为空,我已经在来自不同域的多个 URL 上尝试过它.我也尝试过异步,结果是一样的.responseText 总是正确返回,没有问题.

                  responseXML is always null, and i've tried it on several URLs from different domains. I have also tried it asynchronously, it's the same result. The responseText is always properly returned, no problems with it.

                  我的目标是获得 responseXML.documentElement.

                  感谢您的帮助.

                  编辑-----------
                  此 javascript 代码是从 Greasemonkey 用户脚本执行的,我将其设置为与请求的 url 相同的来源.我也尝试从萤火控制台执行,再次确保原产地政策.两者都有相同的错误.
                  讨厌javascript.

                  EDIT-----------
                  This javascript code was executed from a Greasemonkey userscript, i made surte its the same origin as the requested url. Also i tried executing from firebug console, again ensuring the origin policy. Same error on both.
                  Gotta hate javascript.

                  推荐答案

                  我敢打赌你违反了同源政策.

                  I bet you are violating the same origin policy.

                  对于 XHR,您必须具有相同的协议、域、端口等.因此,如果您在 localhost:8080/app 上运行应用程序,则不能 ajax 到 www.cnn.com.

                  For XHRs, you must have the same protocol, domain, port, etc. So if you are running an app on localhost:8080/app, you CANNOT ajax to www.cnn.com.

                  不同的浏览器有不同的处理方式;我看到FF按照你的描述做了,就是请求看起来正常返回但是没有数据...

                  Different browsers handle this differently; I have seen FF do what you describe, which is the request appears to return normally but there is no data...

                  这篇关于responseXML 始终为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Ajax - 500 内部服务器错误 下一篇:为什么 ProgressEvent.lengthComputable 为假?

                  相关文章

                  最新文章

                  <i id='xpe0Q'><tr id='xpe0Q'><dt id='xpe0Q'><q id='xpe0Q'><span id='xpe0Q'><b id='xpe0Q'><form id='xpe0Q'><ins id='xpe0Q'></ins><ul id='xpe0Q'></ul><sub id='xpe0Q'></sub></form><legend id='xpe0Q'></legend><bdo id='xpe0Q'><pre id='xpe0Q'><center id='xpe0Q'></center></pre></bdo></b><th id='xpe0Q'></th></span></q></dt></tr></i><div id='xpe0Q'><tfoot id='xpe0Q'></tfoot><dl id='xpe0Q'><fieldset id='xpe0Q'></fieldset></dl></div>

                  <small id='xpe0Q'></small><noframes id='xpe0Q'>

                1. <legend id='xpe0Q'><style id='xpe0Q'><dir id='xpe0Q'><q id='xpe0Q'></q></dir></style></legend>

                  • <bdo id='xpe0Q'></bdo><ul id='xpe0Q'></ul>

                      <tfoot id='xpe0Q'></tfoot>