Google Distance Matrix API中的Access-Control-Allow-Origin错误

时间:2018-09-17 10:27:50

标签: google-distancematrix-api

使用google distanceMatrix API时出现错误-

  

无法加载https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=8112%20Alpine%20Ave,%20Sacramento,%20CA%2095826,%20USA&destinations=1550%20W%20Fremont%20St:所请求的资源上不存在“ Access-Control-Allow-Origin”标头。因此,不允许访问来源“ https://zingnow.com”。

我在.htaccess文件中设置了Access-Control-Allow-Origin标头“ *”,但仍然在magento2中出现Access-Control-Allow-Origin标头错误

我正在调用API-https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=8112%20Alpine%20Ave,%20Sacramento,%20CA%2095826,%20USA&destinations=1550%20W%20Fremont%20St%20#100,,%20Stockton,%20California,%2095203,%20United%20States&key=MYAPIKEY

在ajax请求中。

0 个答案:

没有答案