I have this following piece of code.
for(i=0;i<ownerOps[0].length;i++){
// opportunities[i] = "ID #" + ownerOps[0][i].opportunityId + ": Number of Properties - " + ownerOps[0][i].numberOfProperties;
// console.log(opportunities[i]);
gets.push($.get("/getOwnerLeadByLeadId?ownerLeadId="+ownerOps[0][i].ownerLeadId,function(ownerLead,status){
console.log(ownerLead);
console.log("i="+i);
ownerOps[0][i].name=ownerLead.name;
ownerOps[0][i].email=ownerLead.email;
opportunities[i]="Name :"+ownerOps[0][i].name+' Email :'+ownerOps[0][i].email;
}))
}
As get is asynchronous the value of i already gets incremented in the success
handler . Is there anyway to store the value of i while calling get so that it the proper value of i can be used in the success handler?