for (var i=0 ; i<10 ; i++){
var myFunction = function(something){
console.log(i);
}
$.ajax({
url: "something.json",
dataType: "json",
success: function( response ) {
myFunction(response.something);
}
});
}
How do I access latest i in myFunction every time when loop through the for loop. It seems that the latest i in myFunction is not accessible, so it does not log from i = 0 to 9.