码迷,mamicode.com
首页 > Web开发 > 详细

node中js页面发送request请求

时间:2018-01-21 12:38:27      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:fun   发送   使用   style   resolve   进入   eth   cti   odata   

注意:使用promise回调函数

var that = this;
new Promise((resolve, reject) => {
console.log(‘进入Promise方法了‘);
request({
method: ‘GET‘,
url: wx_gettoken_url
}, function(err, res, body) {
if (res) {
resolve({
isSuccess: true,
data: JSON.parse(body)
});
} else {
console.log (err);
reject({
isSuccess: false,
data: err
});
}
})
}).then(proData => {
that.getQrcode(proData);
});

node中js页面发送request请求

标签:fun   发送   使用   style   resolve   进入   eth   cti   odata   

原文地址:https://www.cnblogs.com/pyj63/p/8323724.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!