Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- problem managing a sequence of asynchronous functions.


Fotiman - 12:48 am on Jul 17, 2012 (gmt 0)


Your for loop is a little messy. In particular, it's not clear what this is supposed to do:
id++1
I would suggest changing this to:
for (id = 0; id < workorder.length; id++)

In any case, you know how many requests there are (workorder.length), so you could keep track of some count that increments with each success callback, and inside the callback check to see if the count == the workorder.length (you'll need to store that value), and if so, call printElement.


Thread source:: http://www.webmasterworld.com/javascript/4476245.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com