[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

[Solved] Declaring lambda with int type not working [closed]

Can I make it work in my case somehow? Yes you can. You can either call it immediately after the definition: int median = [](std::vector<int> a) { std::sort(a.begin(), a.end()); return a[a.size() / 2]; }(v); //^^ –> invoke immediately with argument See for reference: How to immediately invoke a C++ lambda? or define the lambda and … Read more