When I am adding values normally it's getting added to json:
Code:
for (var k = 0; k < result.length; k++) {
result[k]["sender"] = k;
}
But when I call value from api and try to store it in result[k]["sender"]
then it's not saving in json and values are getting printed on console:
for (var k = 0; k < result.length; k++) {
var url = "//api";
$.ajax({
url: "https://reverse.geocoder.api.here.com/6.2/reversegeocode.json?prox="+result[k]['lat'].toString()+","+result[k]['lon']+"&mode=retrieveAddresses&app_id=***&app_code=***",
context: document.body,
success: function (data) {
console.log(k, typeof data['Response']['View'][0]['Result'][0]['Location']['Address']['Label']);
result[k]["sender"] = data['Response']['View'][0]['Result'][0]['Location']['Address']['Label'];
}
});
}
Can anyone guide me what I'm missing?