[Solved] Multiple ajax calls in jquery
If the number of ajax calls made are constant,You can use the following logic COUNTER=5; function reduceCounter(){ COUNTER –; if(COUNTER == 0) { localStorage.Obj=JSON.stringify(Obj); location.href=”https://stackoverflow.com/questions/33031287/nextPage.html”; } In each of your ajax calls , call reduceCounter() at .always(); eg: $.ajax({ url: .. type: ‘GET’, dataType: ‘json’, }) .done(){… //set Obj }, .fail(){… },.always(){ reduceCounter(); } solved … Read more