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

  • <legend id='kAMk3'><style id='kAMk3'><dir id='kAMk3'><q id='kAMk3'></q></dir></style></legend>

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

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

        了解跨域 XHR 和 XML 數據

        Understanding Cross domain XHR and XML data(了解跨域 XHR 和 XML 數據)

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

        <tfoot id='HihCT'></tfoot>
          <tbody id='HihCT'></tbody>
          <bdo id='HihCT'></bdo><ul id='HihCT'></ul>
          • <legend id='HihCT'><style id='HihCT'><dir id='HihCT'><q id='HihCT'></q></dir></style></legend>

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

                  本文介紹了了解跨域 XHR 和 XML 數據的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我使用 JavaScript 和 AJAX 已經有一段時間了,我想了解 Cross Domain XHR 是如何工作的以及 JQuery 是如何處理它的,出于某種原因,我從來沒有想過它是如何工作的.我已閱讀 Wikipedia JSONP 文章,我更加困惑.我不確定我不明白什么.

                  I have been working with JavaScript and AJAX for quite sometime, I would like to understand how Cross Domain XHR really work and how JQuery handles it, for some reason I have never bothered to think about how it really works. I have read Wikipedia JSONP article and I am more confused. I am not sure what is that I am not understanding.

                  我知道使用 JSONP 我可以直接在 JavaScript 中使用 JSON 數據.例如 這個 JS Fiddle 示例.這里我使用 JSON 來顯示圖像列表.我可以使用 XML 數據來實現同樣的目的嗎?在回答這部分問題之前,請閱讀類比的其余部分.

                  I am aware that using JSONP I can consume JSON data directly in JavaScript. For example this JS Fiddle example. Here I am using JSON to display list of images. Can I achieve the same thing using XML data instead? Please read rest of the analogy before you answer this part of the question.

                  1) 如果我嘗試類似下面的方法或 Fiddle link 我得到錯誤 未捕獲的 ReferenceError:未定義 jsonFlickrFeed

                  1) If I try something like below or Fiddle link I get error Uncaught ReferenceError: jsonFlickrFeed is not defined

                  ?$.ajax({
                      url: "http://api.flickr.com/services/feeds/photos_public.gne",
                      data: {
                          format: "json"
                      },
                      dataType: "jsonp",
                      success: function(d) {
                          console.log(d);
                      }
                  });?
                  

                  2) 下面的示例或 小提琴鏈接 工作正常

                  2) Example below or fiddle link works fine

                  $.ajax({
                      url : "http://api.flickr.com/services/feeds/photos_public.gne",
                      data: {format: "json"},
                      dataType: "jsonp"
                  });
                  jsonFlickrFeed = function(d){
                      console.log(d);
                  }
                  

                  Q) 我想在 1 和 2 之間,因為返回的數據格式類似于 jsonFlickrFeed({}) 我們需要編寫 jsonFlickrFeed 回調函數來使其工作?

                  Q) I suppose between 1 and 2 since returned data is in format like jsonFlickrFeed({}) we need to write jsonFlickrFeed callback function to make it work?

                  Q) 為什么它從不調用成功回調?

                  Q) Why does it never invoke success callback?

                  Q) 是否是 Flickr 端點負責返回 JSONP(我的意思是格式為 jsonFlickrFeed({}) 的數據)?還是它只是返回實際的 JSON 和 JQuery 填充它?

                  Q) Is it Flickr end point that does the job of returning JSONP(by which I mean data in format jsonFlickrFeed({}))? Or does it just return the actual JSON and JQuery pads it?

                  3) 使用 $.getJSON 的代碼如下所示或 fiddle

                  3) With $.getJSON the code is something like below or fiddle

                  $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?", {
                      format: "json"
                  }, function(d) {
                      console.log(d)
                  });?
                  

                  Q) 在情況 3) 中,JQuery 如何處理它?我看到返回的數據格式為 jQuery1820349100150866434_1355379638775({}) 所以如果我假設 JQuery 完成了將 JSON 與回調關聯的工作,是否正確?

                  Q) How does JQuery take care of it in case 3)? I see that returned data is in format jQuery1820349100150866434_1355379638775({}) So if I assume that JQuery does the job of associating the JSON with the callback is it correct?

                  Q) 由于上述原因,它被稱為 JQuery 的速記方法?

                  Q) For the above reason it is called shorthand method of JQuery?

                  無論我嘗試什么,我都無法使用 XML 數據.我一直想不出一種使用 XML 數據代替 JSON 的方法.

                  From whatever I tried I have failed to consume XML data. I have not been able to think of a way to consume XML data instead of JSON.

                  Q) 是否可以以類似的方式使用 XML 數據而不是 JSON?

                  Q) Is it possible to use XML data instead of JSON in similar way?

                  Q) 我能想到的唯一方法是通過同一域代理數據.這種理解正確嗎?

                  Q) The only way I can think of doing this otherwise is proxying the data through same domain. Is this understanding correct?

                  如果有幫助的話,我在 Dropbox 上有 XML 示例.這是為了證明當XML數據來自同一個域時,它可以被解析.

                  If it helps here is XML example I have on dropbox. Which is to demonstrate that it XML data can be parsed when it originates from the same domain.

                  推薦答案

                  @adeneo 回答了這個問題,但在評論中.所以我對 JSONP 的理解從根本上是有缺陷的.當發出 JSONP 請求時,它不是 XHR 請求.相反,需要注意的是動態插入 script 標簽并獲取 JSON.因此,即使調用看起來像 XHR(至少 IMO JQuery),它也不是.根本沒有使用 XMLHttpRequest 對象.

                  @adeneo answered the question but in comment. So my understanding about JSONP was fundamentally flawed. When JSONP request is made, it is not an XHR request. Rather, caveat is to insert script tag dynamically and fetch the JSON. So even though, the call looks like XHR(at least IMO JQuery), it is not. XMLHttpRequest object is not used at all.

                  這個問題已經回答了 JSONP 到底是什么? 但我不知何故之前錯過了.另一個解釋跨域請求的好資源是 devlog

                  This question has already been answered What is JSONP all about? but I somehow missed it before. Another good resource explaining Cross Domain request is at devlog

                  我提出的其他問題都變得多余了!

                  Rest of the issues I have raised become redundant!

                  這篇關于了解跨域 XHR 和 XML 數據的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 部分內容)
                      1. <i id='FpiZP'><tr id='FpiZP'><dt id='FpiZP'><q id='FpiZP'><span id='FpiZP'><b id='FpiZP'><form id='FpiZP'><ins id='FpiZP'></ins><ul id='FpiZP'></ul><sub id='FpiZP'></sub></form><legend id='FpiZP'></legend><bdo id='FpiZP'><pre id='FpiZP'><center id='FpiZP'></center></pre></bdo></b><th id='FpiZP'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='FpiZP'><tfoot id='FpiZP'></tfoot><dl id='FpiZP'><fieldset id='FpiZP'></fieldset></dl></div>
                          <tbody id='FpiZP'></tbody>
                          <bdo id='FpiZP'></bdo><ul id='FpiZP'></ul>
                            <tfoot id='FpiZP'></tfoot>

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

                            <legend id='FpiZP'><style id='FpiZP'><dir id='FpiZP'><q id='FpiZP'></q></dir></style></legend>
                          1. 主站蜘蛛池模板: 亚洲日韩第一页 | 成人免费在线观看 | 影音先锋欧美资源 | 欧美一级黄色片免费观看 | 国产高清在线精品 | 久久天堂 | 久久久久久久久久久久久久av | 欧美成人h版在线观看 | 成人做爰www免费看视频网站 | 午夜激情影院 | 91在线中文字幕 | 欧美一级欧美一级在线播放 | 日韩一区二区福利视频 | 日韩在线国产精品 | 国产高清久久 | 久草新在线 | 国产成人精品久久二区二区91 | 亚洲 中文 欧美 日韩 在线观看 | 在线观看免费高清av | 国产激情亚洲 | 亚洲精品视频在线观看免费 | 色五月激情五月 | 亚洲国产精品一区二区久久 | 五月婷婷在线视频 | 亚洲成人黄色 | 国产精品久久久久久久久久久免费看 | 亚洲综合日韩精品欧美综合区 | 欧美日韩专区 | 一级黄色夫妻生活 | 国产欧美精品一区二区三区 | 韩国主播午夜大尺度福利 | 欧美精品在线一区二区三区 | 亚洲三区在线观看 | 日韩电影a | 精品亚洲视频在线 | 日本福利视频 | 99综合| 久久伦理中文字幕 | 欧美性一区二区三区 | 亚洲一区二区三区在线视频 | 中文字幕乱码亚洲精品一区 |