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

  • <legend id='4JBHv'><style id='4JBHv'><dir id='4JBHv'><q id='4JBHv'></q></dir></style></legend>

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

        <small id='4JBHv'></small><noframes id='4JBHv'>

      3. XMLHttpRequest 將 POST 更改為 OPTION

        XMLHttpRequest changes POST to OPTION(XMLHttpRequest 將 POST 更改為 OPTION)
        1. <tfoot id='awxoH'></tfoot>
            <bdo id='awxoH'></bdo><ul id='awxoH'></ul>
                  <legend id='awxoH'><style id='awxoH'><dir id='awxoH'><q id='awxoH'></q></dir></style></legend>

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

                    <tbody id='awxoH'></tbody>

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

                2. 本文介紹了XMLHttpRequest 將 POST 更改為 OPTION的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我有這個代碼:

                  net.requestXHR = function() {
                      this.xhr = null;
                      if(window.XMLHttpRequest === undefined) {
                          window.XMLHttpRequest = function() {
                              try {
                                  // Use the latest version of the activex object if available
                                  this.xhr = new ActiveXObject("Msxml2.XMLHTTP.6.0");
                              }
                              catch(e1) {
                                  try {
                                      // Otherwise fall back on an older version
                                      this.xhr = new ActiveXObject("Mxsml2.XMLHTTP.3.0");
                                  }
                                  catch(e2) {
                                      //Otherwise, throw an error
                                      this.xhr = new Error("Ajax not supported in your browser");
                                  }
                              }
                          };
                      }
                      else
                          this.xhr = new XMLHttpRequest();
                  }
                  net.requestXHR.prototype.post = function(url, data) {
                      if(this.xhr != null) {
                          this.xhr.open("POST", url);
                          this.xhr.setRequestHeader("Content-Type", "application/json");
                          this.xhr.send(data);
                      }
                  }
                  
                      var rs = new net.requestSpeech();
                      console.log(JSON.stringify(interaction));
                      rs.post("http://localhost:8111", JSON.stringify(interaction));
                  

                  當(dāng)發(fā)送執(zhí)行時,我有這個日志:

                  when the send execute, i have this log:

                  OPTIONS http://localhost:8111/ [HTTP/1.1 405 Method Not Allowed 74ms]
                  

                  在 localhost:8111 我有一個接受 post 的 reslet serverResource,這是同源策略的問題嗎?我已經(jīng)修改了restlet以放置allow-origin標頭,并使用另一個GET http請求(在jquery中)對其進行測試并且工作正常.我解決了同源問題,因為我使用的是 html5 瀏覽器,并且我的服務(wù)器將標頭放入響應(yīng)中,那么為什么發(fā)送顯示此錯誤?為什么將 POST 更改為 OPTION?謝謝!

                  And in localhost:8111 i have a reslet serverResource that accept post, it is problem of same origin policy? i have modify the restlet to put the allow-origin header and i test it with another GET http request (in jquery) and work ok. I have the problem of same origin resolve because i use an html5 browser and my server put the headers in the response, so why the send shows me this error? why change POST for OPTION? Thanks!

                  可能重復(fù)?:我認為沒有,但確實如此,問題在于兩個問題都一樣,但我的問題是瀏覽器有問題,另一個首先指向jQuery.根據(jù)經(jīng)驗,時間不算重復(fù),答案是不同的,但確實這兩個問題都是互補的彼此.

                  Possible duplicate?: I think no, but it's true, the problem is the same for both questions, but mine are refers since the question that there is an issue with the browser, and the other, first points to jquery. By experience the time does not count for duplicate, the answers are different but it's true that both questions complement each other.

                  推薦答案

                  是的,這是一個同源策略問題".您正在向不同的服務(wù)器或不同的端口發(fā)出請求,這意味著它是一個跨站點 HTTP 請求.以下是文檔對此類請求的說明:

                  Yes, this is a "problem with same-origin policy". You are making your request either to a different server or to a different port, meaning that it is a cross-site HTTP request. Here is what the documentation has to say about such requests:

                  另外,對于可能導(dǎo)致副作用的 HTTP 請求方法服務(wù)器的數(shù)據(jù)(特別是對于 GET 以外的 HTTP 方法,或POST 與某些 MIME 類型一起使用),規(guī)范要求瀏覽器預(yù)檢"請求,從使用 HTTP OPTIONS 請求方法的服務(wù)器,然后,在來自服務(wù)器的批準",發(fā)送帶有實際請求的實際請求HTTP 請求方法.

                  Additionally, for HTTP request methods that can cause side-effects on server's data (in particular, for HTTP methods other than GET, or for POST usage with certain MIME types), the specification mandates that browsers "preflight" the request, soliciting supported methods from the server with an HTTP OPTIONS request method, and then, upon "approval" from the server, sending the actual request with the actual HTTP request method.

                  CORS 標準(Cross-Origin Request with預(yù)檢"部分).您的服務(wù)器需要允許 OPTIONS 請求并使用 Access-Control-Allow-OriginAccess-Control-Allow-HeadersAccess-Control-Allow-Methods 標頭允許請求.然后瀏覽器將發(fā)出實際的 POST 請求.

                  There is a more detailed description in the CORS standard ("Cross-Origin Request with Preflight" section). Your server needs to allow the OPTIONS request and send a response with Access-Control-Allow-Origin, Access-Control-Allow-Headers and Access-Control-Allow-Methods headers allowing the request. Then the browser will make the actual POST request.

                  這篇關(guān)于XMLHttpRequest 將 POST 更改為 OPTION的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)容)
                    <tbody id='kBs8y'></tbody>
                  <i id='kBs8y'><tr id='kBs8y'><dt id='kBs8y'><q id='kBs8y'><span id='kBs8y'><b id='kBs8y'><form id='kBs8y'><ins id='kBs8y'></ins><ul id='kBs8y'></ul><sub id='kBs8y'></sub></form><legend id='kBs8y'></legend><bdo id='kBs8y'><pre id='kBs8y'><center id='kBs8y'></center></pre></bdo></b><th id='kBs8y'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='kBs8y'><tfoot id='kBs8y'></tfoot><dl id='kBs8y'><fieldset id='kBs8y'></fieldset></dl></div>
                    <legend id='kBs8y'><style id='kBs8y'><dir id='kBs8y'><q id='kBs8y'></q></dir></style></legend>

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

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

                            <tfoot id='kBs8y'></tfoot>
                          1. 主站蜘蛛池模板: 99小视频 | 精品网| 亚洲成人一区 | 日韩精品 电影一区 亚洲 | 看av网址 | 亚洲成人一区二区三区 | 欧美亚洲国产日韩 | 中文在线一区二区 | 国产精品一区久久久久 | 久久乐国产精品 | 伊人在线 | 黄色视频a级毛片 | 久久中文视频 | 成人av免费 | 午夜小视频在线播放 | 一区二区三区久久久 | 日韩精品一区二区三区中文在线 | 999久久久久久久久6666 | 亚洲视频欧美视频 | www.蜜桃av| 99在线免费观看 | 日韩精品在线一区 | www.日本在线播放 | 久久久久国产一区二区三区不卡 | 福利在线看 | 精品乱码一区二区 | 久久激情五月丁香伊人 | 福利社午夜影院 | 精品一级毛片 | 91精品国产91久久久久久吃药 | 成人在线免费观看视频 | 欧美中文 | 日韩免费一区二区 | 欧美全黄 | 国产成人精品久久久 | 另类 综合 日韩 欧美 亚洲 | 亚洲91精品 | 91色网站 | 成人精品久久日伦片大全免费 | 日韩一区二区三区四区五区六区 | 日韩中文字幕 |