Hi i am creating a batch update for my local store using for loop and async ajax call.
My problem is that my loop continues even though my ajax call still not yet su
Please don't use "for loop". Instead in the success callback increase the counter and re-trigger itself. something like below.
function mySyncFunction (counter, totRecords){
if(counter === undefined)
counter = 0;
if(counter >=totRecords) return;
var defectssurl = 'https://test.com/mywcf.svc/GetListAllPaging?id=' + counter;
Ext.Ajax.request({
url:defectssurl,
// snip // your code here
success: function (resp) {
// snip // your code here
counter++;
mySyncFunction(counter, totRecords);
}
// snip // your code here
});