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

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

  • <small id='jV6Rd'></small><noframes id='jV6Rd'>

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

        XMLHttpRequest 無法加載,請(qǐng)求的資源上不存在“A

        XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請(qǐng)求的資源上不存在“Access-Control-Allow-Origin標(biāo)頭) - IT屋-程序員軟件開發(fā)技術(shù)分
      1. <small id='VIZXp'></small><noframes id='VIZXp'>

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

              1. <tfoot id='VIZXp'></tfoot>
                  <tbody id='VIZXp'></tbody>
                  本文介紹了XMLHttpRequest 無法加載,請(qǐng)求的資源上不存在“Access-Control-Allow-Origin"標(biāo)頭的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  XMLHttpRequest 無法加載 http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Affenhausen&destinations=Achenkirch&mode=driving&language=de-DE&sensor=false.請(qǐng)求的資源上不存在Access-Control-Allow-Origin"標(biāo)頭.因此,Origin 'null' 不允許訪問.

                  XMLHttpRequest cannot load http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Affenhausen&destinations=Achenkirch&mode=driving&language=de-DE&sensor=false. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

                  Javascript 代碼如下

                  The Javascript code is as

                  function distanceCalc(){
                      start_location = $('select.start option:selected').val();
                      target_location = $('select.end option:selected').val();
                      $.get('http://maps.googleapis.com/maps/api/distancematrix/xml?origins='+start_location+'&destinations='+target_location+'&mode=driving&language=de-DE&sensor=false', function(data) {
                  

                  DreamWeaver 可以工作,但是當(dāng)我通過瀏覽器打開它時(shí),我得到了同樣的錯(cuò)誤.

                  DreamWeaver works, but when I open it via a browser, I get the same error.

                  推薦答案

                  這有點(diǎn)棘手,即使你正確設(shè)置了 CORS,它仍然會(huì)失敗.您應(yīng)該使用 Google 的內(nèi)置函數(shù)來訪問它.如果您嘗試通過 $.get() 或類似方法直接訪問它,它將失敗...查看此示例:https://developers.google.com/maps/documentation/javascript/examples/distance-matrix

                  This is a bit tricky, even if you have CORS set up properly it still fails. You should use Google's build in functions to access it. If you try to access it directly via $.get() or similar it will fail... check this example out: https://developers.google.com/maps/documentation/javascript/examples/distance-matrix

                  有趣的事實(shí),當(dāng)通過 $.get() 訪問時(shí)(我不知道為什么):

                  Interesting fact, when accessing via $.get() (I am not sure why though):

                  -THIS WORKS: http://maps.googleapis.com/maps/api/geocode/
                  
                  -THIS FAILS: http://maps.googleapis.com/maps/api/distancematrix/
                  

                  我的建議 - 不要嘗試通過 get() 獲取 json/xml.使用 google 的 API 內(nèi)置函數(shù)發(fā)送請(qǐng)求,然后正確解析響應(yīng)

                  My advice - don't try fetching json/xml via get(). Use google's API build in functions to send request and then parse the response properly

                  此示例代碼應(yīng)該可以幫助您入門:

                  This example code should get you started:

                  // var origins      = [];
                  // var destinations = [];
                  
                  var distanceMatrix  = new google.maps.DistanceMatrixService();
                  var distanceRequest = { origins: origins, destinations: destinations, travelMode: google.maps.TravelMode.DRIVING, unitSystem: google.maps.UnitSystem.METRIC, avoidHighways: false, avoidTolls: false };
                  distanceMatrix.getDistanceMatrix(distanceRequest, function(response, status) {
                      if (status != google.maps.DistanceMatrixStatus.OK) {
                          alert('Error was: ' + status);
                      }
                      else {
                          var origins      = response.originAddresses;
                          var destinations = response.destinationAddresses;
                          // rest of your code here...
                      }
                  }
                  

                  這篇關(guān)于XMLHttpRequest 無法加載,請(qǐng)求的資源上不存在“Access-Control-Allow-Origin"標(biāo)頭的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調(diào)用 abort (jQuery) 之后,瀏覽器也會(huì)等待 ajax 調(diào)用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請(qǐng)求是否有可能不遵循重定向 (301 302))
                  NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 異常 101)
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內(nèi)容)
                  Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)
                      <tbody id='mnUQO'></tbody>
                  • <small id='mnUQO'></small><noframes id='mnUQO'>

                      <bdo id='mnUQO'></bdo><ul id='mnUQO'></ul>
                      <tfoot id='mnUQO'></tfoot>

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

                          <legend id='mnUQO'><style id='mnUQO'><dir id='mnUQO'><q id='mnUQO'></q></dir></style></legend>
                          • 主站蜘蛛池模板: 亚洲精品久久久9婷婷中文字幕 | 美女在线国产 | 久久精品视频免费观看 | 一区二区在线免费观看 | 亚洲一区 中文字幕 | 欧美a级成人淫片免费看 | 精品一区国产 | 在线播放一区二区三区 | 精品视频久久久久久 | 久久av一区| 欧美男人亚洲天堂 | 完全免费在线视频 | 中文字幕亚洲一区二区三区 | 青青久草| 99re在线播放 | 青草福利 | 黄色一级片视频 | 欧美午夜精品 | 在线观看国产视频 | 亚洲永久字幕 | 一本色道精品久久一区二区三区 | 免费的黄色片子 | 亚洲精品国产第一综合99久久 | 国产高清av免费观看 | 久久久精品 | 中文字幕在线精品 | 国产精品久久久亚洲 | 黄色精品视频网站 | 国色天香成人网 | 韩日av在线 | 国产高清在线精品 | 色天天综合 | 成人区一区二区三区 | 性天堂网| 成人国产精品久久 | 性一区| 美女黄色在线观看 | 91看片免费| 青青久在线视频 | 亚洲一级毛片 | 成人免费黄色 |