我有这段代码试图从印地语中获取演示数据,例如,我从我在桌面中创建的本地 .html 运行它。
var xmlhttp;
if (window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
else
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET", "http://maps.googleapis.com/maps/api/geocode/xml?latlng=40.714224,-73.961452&language=hi&sensor=true", true);
xmlhttp.onreadystatechange = function ()
{
if (xmlhttp.readyState != 4) return;
if (xmlhttp.status != 200 && xmlhttp.status != 304) return;
document.write(xmlhttp.responseText);
};
xmlhttp.send(null);
谷歌不允许我获取数据,因为Access-Control-Allow-Origin
. 我该怎么做才能得到这些数据,我真的很困惑......