pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  • <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="c4miiik" 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="e4mwkgm" id='awxoH'><tfoot id='awxoH'></tfoot><dl id='awxoH'><fieldset id='awxoH'></fieldset></dl></div>

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

                  問題描述

                  我有這個代碼:

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

                  當發送執行時,我有這個日志:

                  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,這是同源策略的問題嗎?我已經修改了restlet以放置allow-origin標頭,并使用另一個GET http請求(在jquery中)對其進行測試并且工作正常.我解決了同源問題,因為我使用的是 html5 瀏覽器,并且我的服務器將標頭放入響應中,那么為什么發送顯示此錯誤?為什么將 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!

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

                  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.

                  推薦答案

                  是的,這是一個同源策略問題".您正在向不同的服務器或不同的端口發出請求,這意味著它是一個跨站點 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:

                  另外,對于可能導致副作用的 HTTP 請求方法服務器的數據(特別是對于 GET 以外的 HTTP 方法,或POST 與某些 MIME 類型一起使用),規范要求瀏覽器預檢"請求,從使用 HTTP OPTIONS 請求方法的服務器,然后,在來自服務器的批準",發送帶有實際請求的實際請求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預檢"部分).您的服務器需要允許 OPTIONS 請求并使用 Access-Control-Allow-OriginAccess-Control-Allow-HeadersAccess-Control-Allow-Methods 標頭允許請求.然后瀏覽器將發出實際的 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.

                  這篇關于XMLHttpRequest 將 POST 更改為 OPTION的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 部分內容)
                    <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="qqk6g4y" 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. 主站蜘蛛池模板: 办公室家具公司_办公家具品牌厂家_森拉堡办公家具【官网】 | HEYL硬度计量泵-荧光法在线溶解氧仪-净时测控技术(上海)有限公司 | 油液红外光谱仪-油液监测系统-燃油嗅探仪-上海冉超光电科技有限公司 | 升降机-高空作业车租赁-蜘蛛车-曲臂式伸缩臂剪叉式液压升降平台-脚手架-【普雷斯特公司厂家】 | 上海办公室装修公司_办公室设计_直营办公装修-羚志悦装 | 聚氨酯催化剂K15,延迟催化剂SA-1,叔胺延迟催化剂,DBU,二甲基哌嗪,催化剂TMR-2,-聚氨酯催化剂生产厂家 | 刹车盘机床-刹车盘生产线-龙口亨嘉智能装备 | 无机纤维喷涂棉-喷涂棉施工工程-山东华泉建筑工程有限公司▲ | 信阳市建筑勘察设计研究院有限公司 | 大型多片锯,圆木多片锯,方木多片锯,板材多片锯-祥富机械有限公司 | 低粘度纤维素|混凝土灌浆料|有机硅憎水粉|聚羧酸减水剂-南京斯泰宝 | 雾度仪_雾度计_透光率雾度仪价格-三恩时(3nh)光电雾度仪厂家 | 除尘器布袋骨架,除尘器滤袋,除尘器骨架,电磁脉冲阀膜片,卸灰阀,螺旋输送机-泊头市天润环保机械设备有限公司 | PCB厂|线路板厂|深圳线路板厂|软硬结合板厂|电路板生产厂家|线路板|深圳电路板厂家|铝基板厂家|深联电路-专业生产PCB研发制造 | 温州中研白癜风专科_温州治疗白癜风_温州治疗白癜风医院哪家好_温州哪里治疗白癜风 | 卷筒电缆-拖链电缆-特种柔性扁平电缆定制厂家「上海缆胜」 | 自动化展_机器人展_机床展_工业互联网展_广东佛山工博会 | 合肥白癜风医院_[治疗白癜风]哪家好_合肥北大白癜风医院 | 南京泽朗生物科技有限公司| Dataforth隔离信号调理模块-信号放大模块-加速度振动传感器-北京康泰电子有限公司 | 短信群发平台_群发短信软件_短信营销-讯鸽科技| 分类168信息网 - 分类信息网 免费发布与查询 | 不发火防静电金属骨料_无机磨石_水泥自流平_修补砂浆厂家「圣威特」 | 不锈钢法兰-碳钢法兰-法兰盘生产加工厂家-[鼎捷峰]-不锈钢法兰-碳钢法兰-法兰盘生产加工厂家-[鼎捷峰] | 100_150_200_250_300_350_400公斤压力空气压缩机-舰艇航天配套厂家 | 上海办公室装修公司_办公室设计_直营办公装修-羚志悦装 | 书法培训-高考书法艺考培训班-山东艺霖书法培训凭实力挺进央美 | 一体化隔油提升设备-餐饮油水分离器-餐厨垃圾处理设备-隔油池-盐城金球环保产业发展有限公司 | 玻纤土工格栅_钢塑格栅_PP焊接_单双向塑料土工格栅_复合防裂布厂家_山东大庚工程材料科技有限公司 | 铝扣板-铝方通-铝格栅-铝条扣板-铝单板幕墙-佳得利吊顶天花厂家 elisa试剂盒价格-酶联免疫试剂盒-猪elisa试剂盒-上海恒远生物科技有限公司 | 作文导航网_作文之家_满分作文_优秀作文_作文大全_作文素材_最新作文分享发布平台 | 中国产业发展研究网 - 提供行业研究报告 可行性研究报告 投资咨询 市场调研服务 | 艺术涂料_进口艺术涂料_艺术涂料加盟_艺术涂料十大品牌 -英国蒙太奇艺术涂料 | 聚氨酯复合板保温板厂家_廊坊华宇创新科技有限公司 | 高压微雾加湿器_工业加湿器_温室喷雾-昌润空气净化设备 | 同步带轮_同步带_同步轮_iHF合发齿轮厂家-深圳市合发齿轮机械有限公司 | 广州冷却塔维修厂家_冷却塔修理_凉水塔风机电机填料抢修-广东康明节能空调有限公司 | 杭州代理记账费用-公司注销需要多久-公司变更监事_杭州福道财务管理咨询有限公司 | 道达尔润滑油-食品级润滑油-道达尔导热油-合成导热油,深圳道达尔代理商合-深圳浩方正大官网 | 锂离子电池厂家-山东中信迪生电源| 四探针电阻率测试仪-振实密度仪-粉末流动性测定仪-宁波瑞柯微智能 |