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。当我做一个警报(..)时,我也可以得到正确的经纬度值。
谢谢