0
我要開發一個互動地圖(谷歌地圖)。該座標通過從JSON解析AJAX,但我得到的錯誤錯誤Ajax和JSON數組
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":[{........},{.....}...]}]}
Ajax請求
$.ajax({
type: "GET",
url: "getcoordp?q=2",
dataType: "json",
cache: false,
contentType: "application/json",
success: function(data) {
$.each(data.Level, function(i,Level){
$.each(data.route, function(index, route) {
alert(data.lat)
});
});
}
});
ERROR
Uncaught TypeError: Cannot read property 'length' of undefined
有幫助嗎?