小程序wx.request带中文参数使用post请求提交请求报400

小程序wx.request带中文参数使用post请求提交请求报400

 

 

原因:请求URL没有格式化

解决方案encodeURI函数

wx.request({
url: encodeURI(url),
data: {},
method: "post",
success: function(res) {
if (typeof callback == "function") {
callback(res)
}
},
fail: function(res) {},
complete: function(res) {
if (showLoad) {
wx.hideLoading()
}

}
})

 

posted on 2019-11-12 14:08  高达  阅读(851)  评论(0)    收藏  举报

导航