2012-02-09 109 views
0

我也有類似的在這裏一個問題:谷歌地圖V3地理編碼查找使用的getJSON

using jquery.getJson with Google's GeoCoding HTTP Service

與我試圖檢索地址的地理座標,而不使用API​​密鑰外,從客戶端查找。

一切似乎都使用此代碼時的工作:

$.getJSON("http://maps.google.com/maps/api/geocode/json?address=202++3991+Henning+Dr+Burnaby+BC+V5C+6N5&sensor=false&callback=?", 
    function(data, textStatus){ 
    console.log(data); 
    console.log(textStatus); 
}); 

不過,我發現了一個「無效的標籤」 jQuery的錯誤。

+0

出於好奇,爲什麼使用這種方法而不是僅僅使用JavaScript Maps API Geocoder? http://code.google.com/apis/maps/documentation/javascript/geocoding.html – 2012-02-09 18:27:10

回答

1

V3地理編碼API不支持回調參數,因此您嘗試創建的JSONP調用將不起作用。相反,您可以使用JavaScript API並使用Geocoding Service或通過Web服務器代理結果(以解決跨站點問題)。