0
Well, I have an array of numbers and I need to send each separate checker to the server, but I need to wait for all of them to be executed before I perform my final action. I searched and then discovered the method/function WHEN
waiting for all requests to be closed to execute X function.
The problem is that I don’t know how to run all the contents of the array and insert it into that WHEN.. I have no idea at all..
See a sample of her:
$.when(ajax1(), ajax2(), ajax3(), ajax4()).done(function(a1, a2, a3, a4){
but my array data doesn’t have only a1, a2, a3 e a4
they can have much more up to "infinite" or simply 1 or 2 items.
My array in case: [1,2,3,4,5,6,6,77,44,23423,234212344]
Ah, I use it forEach
to run the array
For example
$.when(p1, p2).done(retorno1, retorno2){ alert(retorno1 + ' : ' + retorno2) }
we have 2 requests that arep1
andp2
, where your returns areretorno1
andretorno2
, but still your doubt is unclear, and I don’t know exactly, what to answer.– Edilson
And do you have all of these going from the array at once in an array or are you getting ids one by one? If you explain better how the application works becomes clearer
– Sergio