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

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

        <tfoot id='TsjBi'></tfoot>

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

        覆盖 XMLHttpRequest 的发送方法

        时间:2023-10-14
        • <bdo id='DHueL'></bdo><ul id='DHueL'></ul>

          • <legend id='DHueL'><style id='DHueL'><dir id='DHueL'><q id='DHueL'></q></dir></style></legend>

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

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

                  <tfoot id='DHueL'></tfoot>
                  本文介绍了覆盖 XMLHttpRequest 的发送方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试通过重写 XMLHttpRequest.send 函数记录(并稍后修改)XMLHttpRequest 发送到服务器的数据.

                  I'm trying to log (and later modify) the data XMLHttpRequest sends to a server by overriding XMLHttpRequest.send function.

                  我的函数将数据正确记录到控制台,但是请求没有完成,因此浏览器会无限期地等待响应.

                  My function logs the data correctly to the console, however the request doesn't finish, therefore the browser keeps waiting for the response indefinitely.

                  你知道代码有什么问题吗?

                  Any ideas what's wrong with the code?

                  XMLHttpRequest.prototype.realSend = XMLHttpRequest.prototype.send;
                  var newSend = function(vData) { console.log("data: " + vData); realSend(vData); };
                  XMLHttpRequest.prototype.send = newSend;
                  

                  推荐答案

                  XMLHttpRequest.prototype.realSend = XMLHttpRequest.prototype.send;
                  // here "this" points to the XMLHttpRequest Object.
                  var newSend = function(vData) { console.log("data: " + vData); this.realSend(vData); };
                  XMLHttpRequest.prototype.send = newSend;
                  

                  这篇关于覆盖 XMLHttpRequest 的发送方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:传递“#"url的请求参数中的哈希符号在Firefo 下一篇:NETWORK_ERR:XMLHttpRequest 异常 101

                  相关文章

                  最新文章

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

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

                    <legend id='CNIZs'><style id='CNIZs'><dir id='CNIZs'><q id='CNIZs'></q></dir></style></legend>