I'm getting json response from my webserver by $.getJSON . This is the response :
[{"id":"1","latitude":"28.63","longitude":"77.21","price":"0"},{"id":"2","latitude":"28.71","longitude":"77.19","price":"100"}]
And this is my javascript code to convert this response to arrays :
var i = 0;
var vehicleId = $('#selectVehicle option:selected').val();
$.getJSON('getFillingDetails.php', {id : vehicleId}, function(data){
    var lat = [];
    var lon = [];
    var price = [];
    $.each(data, function(key, value){
        lat.push(value.latitude);
        lon.push(value.longitude);
        price.push(value.price);
        i++;
    });
});
console.log(i);
But when I see the value of i in console it doesn't changes . it's still 0. It means nothing is happening inside $.each() . I'm totally new to javascript. Any help will be appreciated. 
 
     
     
     
     
    