久久久久久久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() 函數(shù))
      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() 函數(shù)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

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

                  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() 函數(shù)之前寫 onload() 函數(shù).

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

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

                  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() 函數(shù)處理我們收到的響應,send() 函數(shù)向服務器發(fā)送請求.所以根據(jù)我的理解,onload() 必須寫在 send() 函數(shù)之后.

                  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 被調(diào)用(由 XHR 基礎架構)(或可能在其期間)之后被調(diào)用.當您將它分配給 onload 時,您并不是在 調(diào)用 它.您只是定義它,以便當 XHR 需要調(diào)用它時它就在那里.

                  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.

                  會發(fā)生什么:

                  1. 您創(chuàng)建 XHR.
                  2. 您為其 load 事件注冊一個處理程序(在您的情況下,通過將函數(shù)分配給 onload).
                  3. 你調(diào)用 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 處理會觸發(fā) load 事件.這會查找任何當前注冊的 load 處理程序,并將對這些處理程序的調(diào)用(如果有)排隊.這些調(diào)用會在主 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.
                • 很多時候,你會以錯誤的方式逃脫懲罰,因為在請求完成時,你已經(jīng)將 load 處理程序放在那里;但不是總是.load 是一個事件.如果可以立即滿足請求(例如,從緩存中),瀏覽器可以send 期間觸發(fā) load,并查看是否有任何 load 處理程序 調(diào)用 send 期間,如果沒有,則不對任何回調(diào)的調(diào)用進行排隊.稍后當您附加處理程序時,該事件已經(jīng)被觸發(fā)(當沒有附加處理程序時).

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

                  所以你必須在調(diào)用 send 之前附加處理程序.

                  So you have to attach the handler before calling send.

                  這篇關于為什么我們在 XMLHttpRequest 中寫 send() 之前要寫 onload() 函數(shù)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權益,請聯(liá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ā)技術分
                  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)容)

                    • <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'>

                            主站蜘蛛池模板: 免费av观看 | 免费黄色的网站 | 久久久成人免费一区二区 | 久久久青草婷婷精品综合日韩 | 免费一区二区三区在线视频 | 精品国产一区二区三区久久影院 | 国产激情视频在线 | 毛片免费视频 | 欧美a区| 国产精品久久久久久久久污网站 | 男女羞羞视频免费 | 亚洲伊人久久综合 | 久久久久久久久久久久一区二区 | 久久久久久亚洲精品 | 久草99| 欧美一区二区免费 | 久久久国产一区二区三区 | 黄片毛片免费观看 | 91中文| 女女百合av大片一区二区三区九县 | 久久精品免费观看 | 亚洲日韩中文字幕一区 | 欧美区在线 | 成人午夜影院 | 国产精品久久久久久妇女6080 | 精品日韩一区 | 成人免费淫片aa视频免费 | 亚洲影音先锋 | 中文字幕1区| 亚洲人人| 国产一区二区免费 | jav成人av免费播放 | 亚洲www | 日韩中文字幕在线播放 | 一区二区亚洲 | 狠狠爱综合 | 国产日韩欧美在线 | 亚洲国产欧美在线 | 久久久久一区 | 男人的天堂在线视频 | 日韩一区二区三区在线 |