久久久久久久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>

                          • 主站蜘蛛池模板: 日日摸日日碰夜夜爽2015电影 | 99re99| 国产精久久久久久久 | 久久免费看| 国内精品视频一区二区三区 | 午夜影院黄 | 成人国产一区二区三区精品麻豆 | 日韩欧美亚洲 | 亚洲日本乱码在线观看 | 欧美高清视频一区 | 中国一级大毛片 | 国产精品免费高清 | 日韩欧美在线观看 | a网站在线观看 | 午夜精品一区二区三区在线视频 | 国产日韩欧美综合 | 国精品一区 | 黄色大片观看 | 国产一级特黄aaa大片评分 | 亚洲精品一区在线 | 99综合在线 | 波多野吉衣久久 | 天天操天天干天天爽 | 亚洲乱码国产乱码精品精98午夜 | 欧美一区免费在线观看 | 日韩高清国产一区在线 | 亚洲 欧美 激情 另类 校园 | 日本精品一区二区三区视频 | 国产一区二区三区精品久久久 | 国产精品毛片一区二区三区 | 欧洲一区二区三区 | 99久久精品一区二区成人 | 一级毛片大全免费播放 | 人人玩人人添人人澡欧美 | 精品一区二区av | 成人亚洲精品久久久久软件 | 一区二区三区国产 | 国产 欧美 日韩 一区 | 影音先锋中文字幕在线观看 | 国产精品国产三级国产aⅴ中文 | 男女深夜网站 |