$.getJSON('map_points.json', function(data) {
$.each( data.points, function(i, value) {
var marker = new google.maps.Marker({
position: new google.maps.LatLng(value.lat, value.lon),
map: map,
title: " text " + value.lat
});
});
});
我使用map_points.json
文件中的lat
,lon
值制作了标记。现在,我想在我的谷歌地图中的每个制作者中显示data_points.json
值。
答案 0 :(得分:0)
试试这个:
$.getJSON('map_points.json', function(data) {
$.each( data.points, function(i, value) {
var marker = new google.maps.Marker({
position: new google.maps.LatLng(value.lat, value.lon),
map: map,
title: " Latitude: " + value.lat+" Longiude: "+value.lon//here is the difference
});
//add info window
var iw = new google.maps.InfoWindow({
content: "Latitude: " + value.lat+" Longiude: "+value.lon
});
google.maps.event.addListener(marker, "click", function (e) { iw.open(map, this); });
});
});