pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

    <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="mckeayo" 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="cy2ya2a" 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 是空字符串的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  HTML頁(yè)面:

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

                  請(qǐng)求處理程序:

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

                  現(xiàn)在,當(dāng)我點(diǎn)擊 URL localhost:8080/xhrtest 時(shí),瀏覽器會(huì)立即將響應(yīng) 0 顯示為頁(yè)面內(nèi)容.

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

                  點(diǎn)擊url localhost:8080/xhr間接點(diǎn)擊/xhrtest,在alert框中彈出一個(gè)空字符串(responseText是一個(gè)空字符串)但是檢查在network標(biāo)簽下chrome的response標(biāo)簽,可以看到請(qǐng)求的響應(yīng)是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 不能顯示相同的響應(yīng)?

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

                  推薦答案

                  send 調(diào)用是異步的(您已將 'async' 參數(shù)設(shè)置為 true),這意味著您的警報(bào)會(huì)在請(qǐng)求完成之前立即發(fā)生.您應(yīng)該向 xhr.onreadystatechange 添加一個(gè)事件偵聽(tīng)器并在其中使用響應(yīng).

                  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"可以使這個(gè)簡(jiǎn)單的示例工作,但在一般情況下不是一個(gè)好主意.

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

                  Ajax 上的 MDN 頁(yè)面解釋了如何使用 XMLHttpRequest.

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

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

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

                  相關(guān)文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調(diào)用 abort (jQuery) 之后,瀏覽器也會(huì)等待 ajax 調(diào)用完成)
                  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 無(wú)法加載,請(qǐng)求的資源上不存在“Access-Control-Allow-Origin標(biāo)頭) - IT屋-程序員軟件開(kāi)發(fā)技術(shù)分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請(qǐng)求是否有可能不遵循重定向 (301 302))
                  NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 異常 101)
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內(nèi)容)
                • <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="22gs02o" id='fqO1X'><tfoot id='fqO1X'></tfoot><dl id='fqO1X'><fieldset id='fqO1X'></fieldset></dl></div>

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

                          • 主站蜘蛛池模板: 商标转让-购买商标专业|放心的商标交易网-蜀易标商标网 | 福建成考网-福建成人高考网 | 安徽合肥格力空调专卖店_格力中央空调_格力空调总经销公司代理-皖格制冷设备 | 首页-恒温恒湿试验箱_恒温恒湿箱_高低温试验箱_高低温交变湿热试验箱_苏州正合 | 鑫达滑石-辽宁鑫达滑石集团 | 土壤检测仪器_行星式球磨仪_土壤团粒分析仪厂家_山东莱恩德智能科技有限公司 | 金属雕花板_厂家直销_价格低-山东慧诚建筑材料有限公司 | 森旺-A级防火板_石英纤维板_不燃抗菌板装饰板_医疗板 | 厂房出租_厂房出售_产业园区招商_工业地产&nbsp;-&nbsp;中工招商网 | 专业生物有机肥造粒机,粉状有机肥生产线,槽式翻堆机厂家-郑州华之强重工科技有限公司 | 自动气象站_农业气象站_超声波气象站_防爆气象站-山东万象环境科技有限公司 | 金属管浮子流量计_金属转子流量计厂家-淮安润中仪表科技有限公司 | 哔咔漫画网页版在线_下载入口访问指引 | 同步带轮_同步带_同步轮_iHF合发齿轮厂家-深圳市合发齿轮机械有限公司 | 贴片电容代理-三星电容-村田电容-风华电容-国巨电容-深圳市昂洋科技有限公司 | 深圳快餐店设计-餐饮设计公司-餐饮空间品牌全案设计-深圳市勤蜂装饰工程 | 冷却塔降噪隔音_冷却塔噪声治理_冷却塔噪音处理厂家-广东康明冷却塔降噪厂家 | 玻纤土工格栅_钢塑格栅_PP焊接_单双向塑料土工格栅_复合防裂布厂家_山东大庚工程材料科技有限公司 | 门禁卡_智能IC卡_滴胶卡制作_硅胶腕带-卡立方rfid定制厂家 | 拖鞋定制厂家-品牌拖鞋代加工厂-振扬实业中国高端拖鞋大型制造商 | 氨水-液氨-工业氨水-氨水生产厂家-辽宁顺程化工 | 中红外QCL激光器-其他连续-半导体连续激光器-筱晓光子 | 哲力实业_专注汽车涂料汽车漆研发生产_汽车漆|修补油漆品牌厂家 长沙一级消防工程公司_智能化弱电_机电安装_亮化工程专业施工承包_湖南公共安全工程有限公司 | 纸塑分离机-纸塑分离清洗机设备-压力筛-碎浆机厂家金双联环保 | 广州冷却塔维修厂家_冷却塔修理_凉水塔风机电机填料抢修-广东康明节能空调有限公司 | 世界箱包品牌十大排名,女包小众轻奢品牌推荐200元左右,男包十大奢侈品牌排行榜双肩,学生拉杆箱什么品牌好质量好 - Gouwu3.com | (中山|佛山|江门)环氧地坪漆,停车场地板漆,车库地板漆,聚氨酯地板漆-中山永旺地坪漆厂家 | 自动化展_机器人展_机床展_工业互联网展_广东佛山工博会 | 比亚迪叉车-比亚迪电动叉车堆垛车托盘车仓储叉车价格多少钱报价 磁力去毛刺机_去毛刺磁力抛光机_磁力光饰机_磁力滚抛机_精密金属零件去毛刺机厂家-冠古科技 | 喷涂流水线,涂装流水线,喷漆流水线-山东天意设备科技有限公司 | 搜活动房网—活动房_集装箱活动房_集成房屋_活动房屋 | TPM咨询,精益生产管理,5S,6S现场管理培训_华谋咨询公司 | 论文查重_免费论文查重_知网学术不端论文查重检测系统入口_论文查重软件 | 至顶网| 至顶网| 打包钢带,铁皮打包带,烤蓝打包带-高密市金和金属制品厂 | 信阳网站建设专家-信阳时代网联-【信阳网站建设百度推广优质服务提供商】信阳网站建设|信阳网络公司|信阳网络营销推广 | 烟气换热器_GGH烟气换热器_空气预热器_高温气气换热器-青岛康景辉 | 留学生辅导网-在线课程论文辅导-留学生挂科申诉机构 | 福州时代广告制作装饰有限公司-福州广告公司广告牌制作,福州展厅文化墙广告设计, | 控显科技 - 工控一体机、工业显示器、工业平板电脑源头厂家 |