[英]Nested Callbacks with NodeJS & MySQL
I have come to a time in my java-script adventure where I have needed to nest callbacks. 我已经来过我的java脚本冒险,我需要嵌套回调。 I have the following code. 我有以下代码。 I keep reading bout nested callbacks being hell... if someone could explain or help with the code. 我继续阅读bout嵌套回调是地狱......如果有人可以解释或帮助代码。 I am still very new to asynchronous programming. 我仍然是异步编程的新手。 I am using nodejs
, express 3.0
, jade
, node-mysql
我使用的是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? 什么是处理嵌套回调的更好方法?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.