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

  • <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="kkwukka" id='jV6Rd'><tfoot id='jV6Rd'></tfoot><dl id='jV6Rd'><fieldset id='jV6Rd'></fieldset></dl></div>
      <tfoot id='jV6Rd'></tfoot>

        XMLHttpRequest 無法加載,請求的資源上不存在“A

        XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
      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="wmyqgcq" 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 無法加載,請求的資源上不存在“Access-Control-Allow-Origin"標頭的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  XMLHttpRequest 無法加載 http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Affenhausen&destinations=Achenkirch&mode=driving&language=de-DE&sensor=false.請求的資源上不存在Access-Control-Allow-Origin"標頭.因此,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 可以工作,但是當我通過瀏覽器打開它時,我得到了同樣的錯誤.

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

                  推薦答案

                  這有點棘手,即使你正確設置了 CORS,它仍然會失敗.您應該使用 Google 的內置函數來訪問它.如果您嘗試通過 $.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

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

                  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 內置函數發送請求,然后正確解析響應

                  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

                  此示例代碼應該可以幫助您入門:

                  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...
                      }
                  }
                  

                  這篇關于XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin"標頭的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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?)
                  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 部分內容)
                  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="c0qcauw" 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>
                          • 主站蜘蛛池模板: 北京发电机出租_发电机租赁_北京发电机维修 - 河北腾伦发电机出租 | 焊接烟尘净化器__焊烟除尘设备_打磨工作台_喷漆废气治理设备 -催化燃烧设备 _天津路博蓝天环保科技有限公司 | 过跨车_过跨电瓶车_过跨转运车_横移电动平车_厂区转运车_无轨转运车 | 样品瓶(色谱样品瓶)百科-浙江哈迈科技有限公司 | 立式壁挂广告机厂家-红外电容触摸一体机价格-华邦瀛 | 定量包装机,颗粒定量包装机,粉剂定量包装机,背封颗粒包装机,定量灌装机-上海铸衡电子科技有限公司 | 工业制氮机_psa制氮机厂家-宏骁智能装备科技江苏有限公司 | 鑫达滑石-辽宁鑫达滑石集团 | 生态板-实木生态板-生态板厂家-源木原作生态板品牌-深圳市方舟木业有限公司 | 名律网-法律问题咨询-找律师-法律知识| 合肥防火门窗/隔断_合肥防火卷帘门厂家_安徽耐火窗_良万消防设备有限公司 | 雾度仪_雾度计_透光率雾度仪价格-三恩时(3nh)光电雾度仪厂家 | 深圳市超时尚职业培训学校,培训:月嫂,育婴,养老,家政;化妆,美容,美发,美甲. | 干式变压器厂_干式变压器厂家_scb11/scb13/scb10/scb14/scb18干式变压器生产厂家-山东科锐变压器有限公司 | 新中天检测有限公司青岛分公司-山东|菏泽|济南|潍坊|泰安防雷检测验收 | 灌木树苗-绿化苗木-常绿乔木-价格/批发/基地 - 四川成都途美园林 | 天命文免费算命堂_自助算命_自由算命系统_长文周易 | 衬氟止回阀_衬氟闸阀_衬氟三通球阀_衬四氟阀门_衬氟阀门厂-浙江利尔多阀门有限公司 | 卫浴散热器,卫浴暖气片,卫生间背篓暖气片,华圣格浴室暖气片 | 青岛侦探_青岛侦探事务所_青岛劝退小三_青岛婚外情取证-青岛王军侦探事务所 | 成都亚克力制品,PVC板,双色板雕刻加工,亚克力门牌,亚克力标牌,水晶字雕刻制作-零贰捌广告 | 潍坊青州古城旅游景点攻略_青州酒店美食推荐-青州旅游网 | 无缝钢管-聊城无缝钢管-小口径无缝钢管-大口径无缝钢管 - 聊城宽达钢管有限公司 | 回转炉,外热式回转窑,回转窑炉-淄博圣元窑炉工程有限公司 | MES系统-WMS系统-MES定制开发-制造执行MES解决方案-罗浮云计算 | 小程序开发公司-小程序制作-微信小程序开发-小程序定制-咏熠软件 | 珠宝展柜-玻璃精品展柜-首饰珠宝展示柜定制-鸿钛展柜厂家 | 康明斯发电机,上柴柴油发电机,玉柴柴油发电机组_海南重康电力官网 | POS机官网 - 拉卡拉POS机免费办理|官网在线申请入口 | 石家庄救护车出租_重症转院_跨省跨境医疗转送_活动赛事医疗保障_康复出院_放弃治疗_腾康26年医疗护送转诊团队 | 国际线缆连接网 - 连接器_线缆线束加工行业门户网站 | 断桥铝破碎机_发动机破碎机_杂铝破碎机厂家价格-皓星机械 | 砂磨机_立式纳米砂磨机_实验室砂磨机-广州儒佳化工设备厂家 | 彭世修脚_修脚加盟_彭世修脚加盟_彭世足疗加盟_足疗加盟连锁_彭世修脚技术培训_彭世足疗 | 北京四合院出租,北京四合院出售,北京平房买卖 - 顺益兴四合院 | 铜镍-康铜-锰铜-电阻合金-NC003 - 杭州兴宇合金有限公司 | 超声波破碎仪-均质乳化机(供应杭州,上海,北京,广州,深圳,成都等地)-上海沪析实业有限公司 | 全国国际学校排名_国际学校招生入学及学费-学校大全网 | 安徽华耐泵阀有限公司-官方网站 安德建奇火花机-阿奇夏米尔慢走丝|高维|发那科-北京杰森柏汇 | 宜兴紫砂壶知识分享 - 宜兴壶人 医用空气消毒机-医用管路消毒机-工作服消毒柜-成都三康王 | 红外光谱仪维修_二手红外光谱仪_红外压片机_红外附件-天津博精仪器 |