3
I need to run a loop of asynchronous calls, but they cannot run simultaneously, I have to wait for the end to run another. Only I have no control over this call(It is a js function of Sharepoint CSOM).
So I first my idea is just to detect if a call is already running. If it is running I will test again until there is no more call running, and then yes I continue the loop.
Kind of the idea:
function chamarAjax(){
blablabla();
if(blablabla()){
continuarLoop = false;
}
}
if(!ajaxIsRunning){
if(continuarLoop){
chamarAjax();
}
}
Some of the answers served what you wanted?
– stderr
Not yet. All of them are assuming that I am using the traditional ajax call, via $.ajax and indicating for me to put instructions inside the Success or complete. But as mentioned in the question, I am using a Sharepoint function call (executeQueryAsync).
– Joao Paulo
I mentioned the function, but the ideal was for there to be some generic solution, because it could be useful for many more people.
– Joao Paulo