ajax和json数组中的错误

I'm going to develop an interactive map (google maps).The coordinates parse via ajax from json,but i get error

JSON Format

{"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 REQUEST

$.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

any help?

Replace below

$.each(data.route, function(index, route)...

With

$.each(Level.route, function(index, route) {
    alert(route.lat)
});  

This will fix your issue.

try this

for(i=0;i<data.Level.length;i++){
console.log(data.Level[i].route);
}