I have to perform ajax requests for a specific Array and wait for the server response before proceeding to the next iteration in the loop.
I currently have my iterations performed simultaneously. How do I proceed only after ensuring the success?
Thanks for any advice.
myArray.each(function(val, index) {
new Ajax.Request(myUrl + val, {
onSuccess: function() {
responseFromServer();
}
});
void(0);
});
might try it like this
then just call it with
basically, you want the callback to start the next ajaxrequest, on the next item in your array