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

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

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

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

        MooTools CORS 請求與原生 Javascript

        MooTools CORS request vs native Javascript(MooTools CORS 請求與原生 Javascript)
        <tfoot id='GUim7'></tfoot>
      2. <i id='GUim7'><tr id='GUim7'><dt id='GUim7'><q id='GUim7'><span id='GUim7'><b id='GUim7'><form id='GUim7'><ins id='GUim7'></ins><ul id='GUim7'></ul><sub id='GUim7'></sub></form><legend id='GUim7'></legend><bdo id='GUim7'><pre id='GUim7'><center id='GUim7'></center></pre></bdo></b><th id='GUim7'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='GUim7'><tfoot id='GUim7'></tfoot><dl id='GUim7'><fieldset id='GUim7'></fieldset></dl></div>
            <tbody id='GUim7'></tbody>

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

              <bdo id='GUim7'></bdo><ul id='GUim7'></ul>
              <legend id='GUim7'><style id='GUim7'><dir id='GUim7'><q id='GUim7'></q></dir></style></legend>

                • 本文介紹了MooTools CORS 請求與原生 Javascript的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我有這個(gè) MooTools 代碼:

                  I have this MooTools code:

                  new Request.JSON({
                    method: 'POST',
                    url: URL, /*URL TO ANOTHER DOMAIN*/
                    onSuccess: function(r){
                      callback(r);
                    }
                  }).post(data);
                  

                  并且此代碼不發(fā)送 POST 請求(僅限 OPTIONS)...看看下面的代碼(效果很好):

                  And this code doesn't send POST requests (OPTIONS only)... Look at the code below (it works great):

                  var http = null,
                    params = Object.toQueryString(data);
                  try {
                    http = new XMLHttpRequest();
                  } catch (e) {
                    try {
                      http = new ActiveXObject("Msxml2.XMLHTTP");
                    } catch (e) {
                      try {
                        http = new ActiveXObject("Microsoft.XMLHTTP");
                      } catch (e) {
                        http = null;
                        alert("Your browser does not support AJAX!");
                      }
                    }
                  }
                  var url = URL;
                  http.onreadystatechange = function () {
                    if (http.readyState == 4 && http.status == 200) {
                      var jsonData = JSON.parse(http.responseText); /*OR EVAL*/
                      callback(jsonData);
                    }
                  };
                  http.open("POST", url);
                  http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                  http.send(params);
                  

                  編輯:

                  試過:.setHeader('Content-Type','application/x-www-form-urlencoded');
                  還是什么都沒有……哪里有問題?

                  Tried: .setHeader('Content-Type','application/x-www-form-urlencoded');
                  Still nothing... Where can there be a problem?

                  謝謝!

                  推薦答案

                  這是因?yàn)?MooTools 將一些額外的東西與請求標(biāo)頭捆綁在一起.

                  This is because MooTools bundles some extra stuff with the request headers.

                  例如.如果你的 htaccess 說:

                  eg. if your htaccess says:

                  Header set Access-Control-Allow-Origin: *
                  

                  您需要像這樣制作您的請求:

                  you need to craft your request like that:

                  var foo = new Request({
                      url: 'http://fragged.org/Epitome/example/data/',
                      method: 'get',
                      onComplete: function (data) {
                          // returns an object with name and surname  
                          new Element('div[html="{name} {surname}"]'.substitute(JSON.decode(data))).inject(document.body);
                      }
                  });
                  
                  // need to remove that or CORS will need to match it specifically
                  delete foo.headers['X-Requested-With'];
                  foo.send();    
                  

                  這就是為什么您只能在飛行前看到 OPTIONS.它不喜歡你:)

                  This is why you are only seeing the OPTIONS pre-flight. It does not like you :)

                  您可以將 .htaccess 更改為也匹配 X-Requested-With,這可能是一些額外的安全性".

                  You could change the .htaccess to also match X-Requested-With, which is probably some extra "security".

                  有關(guān)工作示例,請參閱 http://jsfiddle.net/7zUSu/1/ - 我前段時(shí)間我想對 Request https://github.com 進(jìn)行更改時(shí)這樣做了/mootools/mootools-core/issues/2381 已修復(fù).

                  See http://jsfiddle.net/7zUSu/1/ for a working example - I did that a while ago when I wanted to get this change to Request https://github.com/mootools/mootools-core/issues/2381 fixed.

                  這篇關(guān)于MooTools CORS 請求與原生 Javascript的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)容)

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

                    • <bdo id='OdBvh'></bdo><ul id='OdBvh'></ul>

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

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

                        1. <tfoot id='OdBvh'></tfoot>
                            <tbody id='OdBvh'></tbody>

                            主站蜘蛛池模板: 手机av免费在线 | 欧美看片 | 日日夜夜天天久久 | 九九久久国产 | 国产精品高潮呻吟久久久久 | 欧美一级片在线播放 | 国产网站在线免费观看 | 蜜桃精品噜噜噜成人av | 日韩欧美一级精品久久 | av在线播放网 | 台湾佬伊人 | 精品国产一区二区在线 | 亚洲精品视| 91免费视频| 永久免费av | 亚洲欧美日韩一区 | 日韩不卡一二区 | 91精品国产一区二区三区香蕉 | 欧美1页| 久久综合欧美 | 亚洲福利网 | 精品一区二区久久久久久久网站 | 欧美综合久久久 | 精品久久电影 | 最近最新中文字幕 | 91中文| 欧洲精品视频一区 | 成人黄色三级毛片 | 99久久精品国产一区二区三区 | 波多野结衣一区二区三区在线观看 | 日日夜夜91 | 国产一级特黄aaa大片评分 | 国产99久久精品一区二区永久免费 | 久久久精品一区 | 蜜月va乱码一区二区三区 | 日韩欧美国产精品 | 日韩网站在线观看 | 日本电影网站 | 国产99热精品| av在线播放一区二区 | 国产精品区二区三区日本 |