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

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

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

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

      <tfoot id='p0JMz'></tfoot>

        重用 XMLHttpRequest 對象還是創(chuàng)建一個新對象?

        Reuse XMLHttpRequest object or create a new one?(重用 XMLHttpRequest 對象還是創(chuàng)建一個新對象?)

            <tbody id='GCehB'></tbody>
        • <tfoot id='GCehB'></tfoot>

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

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

                  本文介紹了重用 XMLHttpRequest 對象還是創(chuàng)建一個新對象?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我搜索了stackoverflow,但得到了矛盾的答案:

                  I searched stackoverflow but got contradictory answers:

                  為什么要重用 XmlHttpRequest 對象?

                  Ajax 密集型page:重復(fù)使用相同的 XMLHttpRequest 對象還是每次都創(chuàng)建一個新對象?

                  另外,w3schools.com 上也有推薦:

                  Also, there's a recommendation on w3schools.com :

                  如果您的網(wǎng)站上有多個 AJAX 任務(wù),您應(yīng)該創(chuàng)建一種用于創(chuàng)建 XMLHttpRequest 對象的標準函數(shù),并調(diào)用這適用于每個 AJAX 任務(wù).

                  If you have more than one AJAX task on your website, you should create ONE standard function for creating the XMLHttpRequest object, and call this for each AJAX task.

                  為什么推薦這個?我在我的頁面上使用全局 XMLHttpRequest 對象來處理所有 Ajax 任務(wù).

                  Why this recommendation? I'm instead using a global XMLHttpRequest object on my page for handling all Ajax tasks.

                  推薦答案

                  你誤解了 W3School 的建議.我將突出顯示相關(guān)部分:

                  You misunderstood W3School's recommendation. I'll highlight the relevant part:

                  如果您的網(wǎng)站上有多個 AJAX 任務(wù),您應(yīng)該創(chuàng)建一個標準函數(shù)來創(chuàng)建 XMLHttpRequest 對象,并為每個 AJAX 任務(wù)調(diào)用它.

                  If you have more than one AJAX task on your website, you should create ONE standard function for creating the XMLHttpRequest object, and call this for each AJAX task.

                  它說您使用一個 AJAX 函數(shù)來獲取請求.這個函數(shù)會處理IE和其他瀏覽器的不一致.XMLHttpRequest 在符合標準的瀏覽器中,ActiveXObject 在 IE 中.

                  It says that you use one AJAX function to fetch requests. This function will deal with the inconsistencies between IE and other browsers. XMLHttpRequest in standard-compliant browsers, and ActiveXObject in IE.

                  我建議使用多個 XHR 對象.使用一個全局 xhr 對象,您的應(yīng)用程序在給定時間只能處理一個請求.它也容易出錯(例如,XMLHttpRequest 啟動多次而不啟動 onreadystatechange 函數(shù)).

                  I recommend to use multiple XHR objects. With one global xhr object, your application can only deal with one request at a given time. It's also error-prone (eg. XMLHttpRequest launches multiple times without initiating the onreadystatechange function).

                  W3schools 的意思是:

                  W3schools meant something like:

                  function createXHR() {
                      try {
                          return new XMLHttpRequest();
                      } catch (e) {
                          try {
                              return new ActiveXObject("Microsoft.XMLHTTP");
                          } catch (e) {
                              return new ActiveXObject("Msxml2.XMLHTTP");
                          }
                      }
                  }
                  var xhr = createXHR();
                  xhr.open('get', '/test', true);
                  xhr.send();
                  

                  雖然最好創(chuàng)建一個處理請求的函數(shù),例如 jQuery.ajax.

                  Although it's better to create a function which handles requests, such as jQuery.ajax.

                  這篇關(guān)于重用 XMLHttpRequest 對象還是創(chuàng)建一個新對象?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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標頭) - 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)容)

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

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

                        <tbody id='AT207'></tbody>
                        <bdo id='AT207'></bdo><ul id='AT207'></ul>

                          <tfoot id='AT207'></tfoot>

                          <legend id='AT207'><style id='AT207'><dir id='AT207'><q id='AT207'></q></dir></style></legend>
                            主站蜘蛛池模板: 国内自拍真实伦在线观看 | 亚洲一区二区成人 | 国产精华一区 | 中文久久| www久久久 | 国产一区二区视频在线 | 亚洲高清在线视频 | 国产成人高清成人av片在线看 | 日韩精品一区二区三区中文在线 | 91麻豆精品国产91久久久久久 | 中文日本在线 | 久久久久国产一区二区三区 | avav在线看 | 午夜小视频免费观看 | 国产电影一区二区三区爱妃记 | 国产有码 | 免费一二区| 午夜丰满寂寞少妇精品 | 精品视频一区在线 | 精品国产乱码久久久久久影片 | 国产精品一区二区日韩 | 日韩一区在线播放 | 久久逼逼 | 成人国产精品久久久 | 老妇激情毛片免费 | 国产成人精品一区二区三区在线观看 | 日韩一区二区三区在线看 | 国产精品久久久久久久久久久免费看 | 99精品在线免费观看 | 国产成人av电影 | 桃花av在线 | 国产精品毛片无码 | 国产午夜久久 | 国产精品日韩高清伦字幕搜索 | 久久久久国产精品www | 日韩毛片网 | 在线国产视频 | 草草视频在线免费观看 | 二区中文字幕 | 美国a级毛片免费视频 | 亚洲精品国产电影 |