微信小程序request请求
get方法:
wx.request({
url: http_host+'/home/good/'+id+'/edit',
method: 'GET',
header: {
"Content-Type": "application/x-www-form-urlencoded"
},
success: function (res) {
console.log('banner',res.data);//打印请求内容
that.setData({
good_message:res.data.good,//赋值
product_detail:res.data.detali,
product_list: res.data,
pro_msg: res.data.detali,
pro_pos:res.data.guige
})
}
})
post方法:
wx.request({
url: http_host + '/home/share',//接口
method: 'post',
header: {
"Content-Type": "application/x-www-form-urlencoded"
},
data: {
要post的数据
},
success: function (res) {
console.log('提交成功', res)
}
})