0
我目前使用的“请求”模块获得来自外部的页面数据的回调函数里面工作: 如果我使用下面的代码,它不工作:.save()不
request(SITE_URL, function (error, response, body) {
var user = new gasStation({ id: 12345, name: 'Gustavo' });
user.save();
});
但如果我打这个电话能够正常运行的要求外功能:
var user = new gasStation({ id: 12345, name: 'Gustavo' });
user.save();
request(SITE_URL, function (error, response, body) {
// some stuff
});
这究竟是为什么?
你如何检查它是否工作? – Shota
一般建议。切勿忽略'error'参数。 – thefourtheye
你能指定第一段代码“不工作”吗? – Andrey