一、Get请求
wx.request({
url: 'http://localhost:8080/weixin/setPunna?id="1"',
method: 'GET',
header: {
'content-type': 'application/json' // 默认值
})
二、Post请求
wx.request(
{
url:"http://localhost:8080/weixin/setPunna?id='1'",
header:{
"Content-Type":"application/x-www-form-urlencoded"
},
method:"POST",
data:{
poon:this.data.list,
nickname:this.data.userInfo.nickName,
},
dataType:"json",
complete:function(res) {
console.log("用户数据发送成功")
}
})