2
無論出於何種原因,以下請求沒有得到谷歌的迴應。但是,如果我將URL粘貼到地址欄中,它可以正常工作。我不確定爲什麼會發生這種情況。 Google是否通過引薦來源的標題過濾了請求?谷歌地圖json地理編碼,在瀏覽器中沒有響應
http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=3122%2C%20Australia
$.ajax({
url:'http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address='+post_code+encodeURIComponent(', Australia'),
success:function(data) {
alert(data);
if(data['status'] == 'OK') {
var location = data['results'][0]['geometry']['location'];
map.panTo(location['lat']+':'+location['lng']);
map.setZoom(8);
}
}
});
感謝您的快速響應!我得到它的工作,並回來發現你已經改變它使用geometry.location。工作很好,我相信這對其他人很有用。 – Keyo 2010-09-30 00:20:40
謝謝! – callumander 2011-06-10 10:31:11
關於如何扭轉這種情況的任何提示,我需要從latlng值中獲得一個城鎮/城市。 – 2011-10-25 14:01:18