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

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

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

    1. <tfoot id='NdJhG'></tfoot>

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

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

        為什么我們在 XMLHttpRequest 中寫 send() 之前要寫

        Why do we write onload() function before we write send() in XMLHttpRequest(為什么我們在 XMLHttpRequest 中寫 send() 之前要寫 onload() 函數)
      1. <small id='UgXeq'></small><noframes id='UgXeq'>

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

              <tfoot id='UgXeq'></tfoot>

                    <tbody id='UgXeq'></tbody>
                  本文介紹了為什么我們在 XMLHttpRequest 中寫 send() 之前要寫 onload() 函數的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我是 XMLHttpRequest 的新手.我不明白為什么我們要在 send() 函數之前編寫 onload() 函數.onload() 函數處理我們收到的響應,然后 send() 函數向服務器發送請求.所以根據我的理解,onload() 必須在 send() 函數之后編寫.有人可以幫助理解這一點.

                  I am new to XMLHttpRequest. I dont understand why do we write onload() function before send() function. onload() function process the response what we receive and send() function sends a request to server. So onload() has to be written after send() function as per my understanding. Can somebody help to understand this.

                  var xmlhttp = new XMLHttpRequest(),
                    method = 'GET',
                    url = 'https://developer.mozilla.org/';
                  
                  xmlhttp.open(method, url, true);
                  xmlhttp.onload = function () {
                    // Do something with the retrieved data
                  };
                  xmlhttp.send();
                  

                  推薦答案

                  我不明白為什么我們要在 send() 函數之前寫 onload() 函數.

                  I dont understand why do we write onload() function before send() function.

                  以便在發送請求之前加載處理程序,因為發送請求將導致調用處理程序(如果成功).

                  So that the load handler is in place before the request is sent, since sending the request will result in calling the handler (if successful).

                  onload() 函數處理我們收到的響應,send() 函數向服務器發送請求.所以根據我的理解,onload() 必須寫在 send() 函數之后.

                  onload() function process the response what we receive and send() function sends a request to server. So onload() has to be written after send() function as per my understanding.

                  它在 send 被調用(由 XHR 基礎架構)(或可能在其期間)之后被調用.當您將它分配給 onload 時,您并不是在 調用 它.您只是定義它,以便當 XHR 需要調用它時它就在那里.

                  It's called after send is called (by the XHR infrastructure) (or potentially during). When you assign it to onload, you're not calling it. You're just defining it so that it's there when XHR needs to call it.

                  會發生什么:

                  1. 您創建 XHR.
                  2. 您為其 load 事件注冊一個處理程序(在您的情況下,通過將函數分配給 onload).
                  3. 你調用 send.
                  1. You create the XHR.
                  2. You register a handler for its load event (in your case, by assigning a function to onload).
                  3. You call send.
                  1. 瀏覽器啟動(并可能完成)請求

                • 當請求完成時,如果成功,瀏覽器的 XHR 處理會觸發 load 事件.這會查找任何當前注冊的 load 處理程序,并將對這些處理程序的調用(如果有)排隊.這些調用會在主 JavaScript 線程可用于運行它們時立即運行.
                • When the request finishes, if it's successful, the browser's XHR handling triggers the load event. That looks for any currently-registered handlers for load and queues calls to those handlers, if any. Those calls are run as soon as the main JavaScript thread is available to run them.
                • 很多時候,你會以錯誤的方式逃脫懲罰,因為在請求完成時,你已經將 load 處理程序放在那里;但不是總是.load 是一個事件.如果可以立即滿足請求(例如,從緩存中),瀏覽器可以send 期間觸發 load,并查看是否有任何 load 處理程序 調用 send 期間,如果沒有,則不對任何回調的調用進行排隊.稍后當您附加處理程序時,該事件已經被觸發(當沒有附加處理程序時).

                  Very often, you'd get away with doing it the wrong way around because by the time the request completes, you'll have put the load handler there; but not always. load is an event. If the request can be satisfied immediately (for instance, from cache), the browser could fire load during send, and look to see if there's any load handler during the call to send, and if there isn't, not queue a call to any callback. Later when you attach a handler, the event has already been fired (when none were attached).

                  所以你必須在調用 send 之前附加處理程序.

                  So you have to attach the handler before calling send.

                  這篇關于為什么我們在 XMLHttpRequest 中寫 send() 之前要寫 onload() 函數的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 部分內容)

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

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

                            主站蜘蛛池模板: 狠狠操你 | 亚洲精品一区二区 | 欧美在线视频网 | 99热这里有精品 | 色婷婷综合久久久中字幕精品久久 | 亚洲在线中文字幕 | 日本午夜精品 | 亚洲欧美日韩在线一区二区 | 激情国产视频 | 日韩中文字幕网 | 欧美一区| 特级毛片 | 欧美日韩一本 | 欧美高清视频 | 亚洲欧洲在线看 | 欧美日韩综合视频 | 夜夜骚 | 国产高清精品在线 | 国产伦精品一区二区三区高清 | 蜜臀久久99精品久久久久久宅男 | 国产91综合一区在线观看 | 日韩av在线不卡 | 国产精品久久久久久久久久免费看 | 一区二区免费高清视频 | 99精品一区二区 | 国产精品一区二区无线 | 992人人草| 欧美日韩一区二区三区四区 | 成人在线观看中文字幕 | 久久国产精品一区二区三区 | 91五月婷蜜桃综合 | 国产在线色 | 中文字幕日韩一区 | 亚洲人成人网 | 国产欧美一区二区三区日本久久久 | 99视频在线免费观看 | 在线国产视频 | 91av精品 | 美美女高清毛片视频免费观看 | 中文字幕第一页在线 | 男女深夜网站 |