У меня есть цикл, который отправляет запросы AJAX.Я хочу включить индекс цикла в мою функцию обратного вызова ajax:
for (i=0;i<10;i++) {
$.ajax({
data: "index="+i
success: function (data) {
//I want to be able to see the variable (i) here
//since the request is async, it returns the last index on all
$("#div"+i).append(data);
}
})
}