I have something like this:
for(k in array){
var importantData = array[k];
$.post('user/list',{name:importantData.username},function(data){
console.log('UID of '+importantData.username+' is:'+data.id);
});
}
The problem is with "importantData" var, when i use it inside post callback it is always the last value, so i get something like:
UID of michelle is 11
UID of michelle is 6
UID of michelle is 23
¿How can encapsulate that var to get the real data of each case?