wx.request post 的 content-type 默认为 'application/json'
如果服务器没有用到 json 解释的话,可以把 content-type 设置回 urlencoded。
wx.request({
url: app.url + 'signup/2',
data: {
username: username,
telephone: telephone
},
method:'POST',
header: {
// 'Content-Type': 'application/json'
"content-type": "application/x-www-form-urlencoded"
},
success: function (res) {
console.log(res.data);
},
complete: function () {
}
})
终于可以post提交了,大家不要按照官网的文档写,也不用转格式,修改header即可。
宠物免费领养小程序,欢迎来踩