This should help: https://github.com/caolan/async
On Mon, Jul 16, 2012 at 5:55 PM, john.tiger <[email protected]>wrote: > stuck in async hell - page displaying (with null) before going thru full > loop and returning total with data - probably some simple funct wrap but > can't see it - thks for any help > > var staff = ["bill","mary"]; > var total = []; > get_total_list(staff, function(err, callback) { > for (var i=0; i<staff.length; i++) { > get_staff_children(staff[i], function(err, cb) { > total.push(cb); > }); > } > callback(err, total || {}); > }); > > total => [] > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: https://github.com/joyent/**node/wiki/Mailing-List-** > Posting-Guidelines<https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines> > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > nodejs+unsubscribe@**googlegroups.com<nodejs%[email protected]> > For more options, visit this group at > http://groups.google.com/**group/nodejs?hl=en?hl=en<http://groups.google.com/group/nodejs?hl=en?hl=en> > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
