I have come to a time in my java-script adventure where I have needed to nest callbacks. I have the following code. I keep reading bout nested callbacks being hell... if someone could explain or help with the code. I am still very new to asynchronous programming. I am using nodejs
, express 3.0
, jade
, node-mysql
db_helper.getCategory(function (category) {
db_helper.getCities(function (cities) {
res.render('/search', category: category, cities: cities });
});
});
i apologize for not really asking. Im wondering if this is ok to do this? Whats a better way to handle nested callbacks?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.