久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

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

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

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

      1. XHR responseText 是空字符串

        XHR responseText is empty string(XHR responseText 是空字符串)
        <tfoot id='XNfLa'></tfoot>
        • <i id='XNfLa'><tr id='XNfLa'><dt id='XNfLa'><q id='XNfLa'><span id='XNfLa'><b id='XNfLa'><form id='XNfLa'><ins id='XNfLa'></ins><ul id='XNfLa'></ul><sub id='XNfLa'></sub></form><legend id='XNfLa'></legend><bdo id='XNfLa'><pre id='XNfLa'><center id='XNfLa'></center></pre></bdo></b><th id='XNfLa'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='XNfLa'><tfoot id='XNfLa'></tfoot><dl id='XNfLa'><fieldset id='XNfLa'></fieldset></dl></div>

          • <bdo id='XNfLa'></bdo><ul id='XNfLa'></ul>
                <tbody id='XNfLa'></tbody>

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

                • <small id='XNfLa'></small><noframes id='XNfLa'>

                • 本文介紹了XHR responseText 是空字符串的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  HTML頁面:

                  <!doctype html>
                  <html lang="en">
                  <head>
                      <meta charset="UTF-8">
                      <title>xhr</title>
                  </head>
                  <body>
                      <script>
                          var xhr_test = new XMLHttpRequest();
                          xhr_test.open("GET","xhrtest",true);
                          xhr_test.send();
                          alert(xhr_test.responseText);
                      </script>
                  </body>
                  </html>
                  

                  main.py 文件:

                  The main.py file:

                  import webapp2
                  from handlers import cookies,pages
                  application = webapp2.WSGIApplication([
                          ('/xhr',pages.XHR),
                          ('/xhrtest', cookies.XHRTest)
                          ],
                              debug=True)
                  

                  請求處理程序:

                  class XHRTest(webapp2.RequestHandler):
                      def get(self):
                          self.response.write('0')
                  

                  和,

                  class XHR(webapp2.RequestHandler):
                      def get(self):
                          f = open('static/html/xhr.html','r')
                          self.response.write(f.read())
                  

                  現在,當我點擊 URL localhost:8080/xhrtest 時,瀏覽器會立即將響應 0 顯示為頁面內容.

                  Now, when I hit upon the url localhost:8080/xhrtest the browser promptly shows the response 0 as the page's content.

                  點擊url localhost:8080/xhr間接點擊/xhrtest,在alert框中彈出一個空字符串(responseText是一個空字符串)但是檢查在network標簽下chrome的response標簽,可以看到請求的響應是0.

                  Hitting the url localhost:8080/xhr which indirectly hits /xhrtest, pops up an empty string in the alert box (the responseText is an empty string) but checking chrome's response tab under the network tab, I can see that the request's response is 0.

                  那么為什么 xhr_test.responseText 不能顯示相同的響應?

                  So why is xhr_test.responseText not able to display the same response?

                  推薦答案

                  send 調用是異步的(您已將 'async' 參數設置為 true),這意味著您的警報會在請求完成之前立即發生.您應該向 xhr.onreadystatechange 添加一個事件偵聽器并在其中使用響應.

                  The call to send is asynchronous (you've set the 'async' parameter to true), which means that your alert is happening immediately, before the request finishes. You should add an event-listener to xhr.onreadystatechange and use the response within that.

                  將true"更改為false"可以使這個簡單的示例工作,但在一般情況下不是一個好主意.

                  Changing the 'true' to 'false' would make this simple example work, but is not a good idea in the general case.

                  Ajax 上的 MDN 頁面解釋了如何使用 XMLHttpRequest.

                  The MDN page on Ajax explains how XMLHttpRequest should be used.

                  這篇關于XHR responseText 是空字符串的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 異常 101)
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                • <legend id='fqO1X'><style id='fqO1X'><dir id='fqO1X'><q id='fqO1X'></q></dir></style></legend>
                • <small id='fqO1X'></small><noframes id='fqO1X'>

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

                        <tbody id='fqO1X'></tbody>

                          • 主站蜘蛛池模板: 午夜激情福利视频 | 一区二区三区久久 | 欧美成人精品一区二区三区在线看 | 日韩精品一级毛片在线播放 | 国产精品视频播放 | 中文字幕在线免费看线人 | 午夜88 | 精品少妇3p | 欧美亚洲一区二区三区 | 五月天开心网 | 国产这里只有精品 | 国产h视频在线观看 | 黄色特级片 | 国产一区二区三区在线视频 | 成人在线网址 | 99久久精品国产亚洲 | 久久综合久色欧美综合狠狠 | 亚洲免费视频网站 | 亚洲精品国产精品乱码不卡 | 欧美专区第一页 | 黄色一级片视频 | 成人在线小视频 | av网站免费在线观看 | 久草青青草 | 欧美操 | 日韩视频二区 | 午夜一级视频 | 久久久一级片 | 日韩精品免费在线观看 | 国产精品99999 | 男女无遮挡xx00动态图120秒 | 午夜黄视频 | 一区二区免费在线观看 | 免费观看的黄色网址 | 国产成人在线观看免费网站 | 99视频免费 | 欧美成人久久 | 国产欧美日韩在线 | 日韩精品免费视频 | 日韩理论在线 | 日韩av一二三区 |