我试图使用以下代码从google-map-api获取JSON(某些半径的加油站):
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=50.4016469,30.6269542&radius=500&keyword=%D0%B7%D0%B0%D0%BF%D1%80%D0%B0%D0%B2%D0%BA%D0%B0&key=AIzaSyDdzZrGvAKqSRj7NHxsW6FqGpx8Bi_nCFw', false);
xhr.onload = function() {
alert(this.responseText);
}
xhr.onerror = function() {
alert('Error ' + this.status);
}
xhr.send();
并拥有CORS«Access-Control-Allow-Origin»的eroor。有没有办法从谷歌地图api获取数据?