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

      <tfoot id='tGb4N'></tfoot>

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

      <i id='tGb4N'><tr id='tGb4N'><dt id='tGb4N'><q id='tGb4N'><span id='tGb4N'><b id='tGb4N'><form id='tGb4N'><ins id='tGb4N'></ins><ul id='tGb4N'></ul><sub id='tGb4N'></sub></form><legend id='tGb4N'></legend><bdo id='tGb4N'><pre id='tGb4N'><center id='tGb4N'></center></pre></bdo></b><th id='tGb4N'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='tGb4N'><tfoot id='tGb4N'></tfoot><dl id='tGb4N'><fieldset id='tGb4N'></fieldset></dl></div>
        • <bdo id='tGb4N'></bdo><ul id='tGb4N'></ul>
        <legend id='tGb4N'><style id='tGb4N'><dir id='tGb4N'><q id='tGb4N'></q></dir></style></legend>
      1. 循環(huán)中的 XMLHttpRequest

        XMLHttpRequest in for loop(循環(huán)中的 XMLHttpRequest)
          <bdo id='NSXgi'></bdo><ul id='NSXgi'></ul>

                <tfoot id='NSXgi'></tfoot>

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

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

                  本文介紹了循環(huán)中的 XMLHttpRequest的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在嘗試在 for 循環(huán)中發(fā)出多個服務(wù)器請求.我發(fā)現(xiàn) this question 并實施了建議的解決方案.但是它似乎不起作用.

                  I am trying to make several server requests inside a for loop. I found this question and implemented the suggested solution. However it doesn't seem to work.

                      for (var i = 1; i <= 10; i++)
                      {
                      (function(i) {
                      if(<some conditions>)
                      {
                      if (window.XMLHttpRequest) {
                          // code for IE7+, Firefox, Chrome, Opera, Safari
                          xmlhttp[i]=new XMLHttpRequest();
                        } else { // code for IE6, IE5
                          xmlhttp[i]=new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        xmlhttp[i].onreadystatechange=function() {
                          if (xmlhttp[i].readyState==4 && xmlhttp[i].status==200) {
                            document.getElementById("preselection").innerHTML=xmlhttp[i].responseText;
                          }
                        }
                        xmlhttp[i].open("GET","getBuoys.php?q="+i,true);
                        xmlhttp[i].send();
                      }
                  })(i);
                  }
                  

                  如果我刪除 for 循環(huán)并將所有 xmlhttp[i] 更改為 xmlhttp,對于一個元素來說一切正常,但我無法發(fā)出多個請求.提前感謝您的任何建議.

                  If I remove the for loop and change all xmlhttp[i] to xmlhttp, everything works just fine for one element, but I can't make several requests. Thanks in advance for any suggestions.

                  推薦答案

                  試試下面的代碼片段

                  // JavaScript
                  window.onload = function(){
                  
                      var f = (function(){
                          var xhr = [], i;
                          for(i = 0; i < 3; i++){ //for loop
                              (function(i){
                                  xhr[i] = new XMLHttpRequest();
                                  url = "closure.php?data=" + i;
                                  xhr[i].open("GET", url, true);
                                  xhr[i].onreadystatechange = function(){
                                      if (xhr[i].readyState === 4 && xhr[i].status === 200){
                                          console.log('Response from request ' + i + ' [ ' + xhr[i].responseText + ']'); 
                                      }
                                  };
                                  xhr[i].send();
                              })(i);
                          }
                      })();
                  
                  };
                  
                  // PHP [closure.php]
                  echo "Hello Kitty -> " . $_GET["data"];
                  

                  回應(yīng)

                  Response from request 0 [ Hello Kitty -> 0]
                  Response from request 1 [ Hello Kitty -> 1]
                  Response from request 2 [ Hello Kitty -> 2] 
                  

                  這篇關(guān)于循環(huán)中的 XMLHttpRequest的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調(diào)用 abort (jQuery) 之后,瀏覽器也會等待 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 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標(biāo)頭) - IT屋-程序員軟件開發(fā)技術(shù)分
                  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 部分內(nèi)容)
                  <legend id='bYrYj'><style id='bYrYj'><dir id='bYrYj'><q id='bYrYj'></q></dir></style></legend>
                1. <small id='bYrYj'></small><noframes id='bYrYj'>

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

                            <bdo id='bYrYj'></bdo><ul id='bYrYj'></ul>

                          • 主站蜘蛛池模板: 超碰男人天堂 | 亚洲精品99| 午夜网站视频 | 一级毛片大全免费播放 | 成在线人视频免费视频 | 一区二区三区视频在线免费观看 | av网站在线免费观看 | 亚洲视频免费在线播放 | 久久久久九九九女人毛片 | 日韩人体视频 | 日日骚视频 | 亚洲成人一区二区 | 日韩a级片 | 久久久久久久久淑女av国产精品 | 老司机免费视频 | 91视频观看 | 久久蜜桃av一区二区天堂 | 免费的一级视频 | 一区二区免费 | 91视频久久 | 精品在线一区 | 91www在线观看| 国产成人精品午夜视频免费 | www.中文字幕.com| 91精品在线播放 | 国产精品久久一区二区三区 | 免费国产一区 | 欧美精品欧美精品系列 | 欧美色成人 | 欧美xxxx色视频在线观看免费 | 国产污视频在线 | 欧美日韩一区精品 | 日韩中文在线视频 | 久色网| 精品国产乱码久久久久久丨区2区 | 在线欧美小视频 | 91人人视频在线观看 | 国产精品久久久久一区二区三区 | 国产羞羞视频在线观看 | 一区二区在线 | 91视频在线观看免费 |