Tuesday, 22 December 2015

Get data from multiple callbacks without nesting them?

I'm trying to get data from multiple callbacks, but for some reason my variables won't set. For example..var data1 = ""; var data3 = ""; myFunction(function(data) { data1 = data; } mySecondFunction(function(data2) { data3 = data2; } res.render('index', { info: data 1, title: data3}); This won't work. I want to call different functions, and set them inside variables without nesting. How can I do that?

Submitted December 23, 2015 at 01:32AM by scottcfr

No comments:

Post a Comment