1
我已經編碼了部分,我獲取標記的JOSN並遍歷它們。但由於某些原因,標記沒有顯示在地圖上。有人能幫我找到這個錯誤嗎?谷歌地圖api json ajax - 標記不顯示
$.ajax({
url: "get_markers.php",
type: 'POST',
dataType: 'json',
data: {'address':address},
success: function (html, status, response) {
$.each(html, function(i, place) {
alert(JSON.stringify(place.lat)+","+JSON.stringify(place.lng));
latLng = new google.maps.LatLng(JSON.stringify(place.lat), JSON.stringify(place.lng));
marker = new google.maps.Marker({
position: latLng,
map: map
//title: data.title
});
});
}
我已經定義了map變量latLng和marker。當我做一個警報(..)時,我也可以得到正確的經緯度值。
謝謝