我将通过 AJAX 解析值/坐标并在谷歌地图上显示为标记。
AJAX 代码
$.each(data.Level, function(i, Level) {
$.each(Level.route, function(index, route) {
// alert(route.lat)
myLatlngcc = new google.maps.LatLng(route.lat, route.lgn);
var markercc = new google.maps.Marker({
position: myLatlngcc,
map: map
});
markers.push(markercc);
});
JSON
{
"Level": [
{
"route": [
{
"lat": 39.105251,
"lgn": 26.551727
},
{
"lat": 39.105247125,
"lgn": 26.551774625
}...
],
"balls": [
{
"lat": 39.105239375,
"lgn": 26.551869875
},
{
"lat": 39.10524325,
"lgn": 26.55182225
}
]
},
{
"route": [
{
........
},
{
.....
}...
],
"balls": [
{
........
},
{
.....
}...
]
}
]
}
我只想获取数组中包含的lat
和对象。任何想法我怎么能做到这一点?lgn
route[1]