微信小程序wx.request POST获取不到数据解决办法
生活随笔
收集整理的這篇文章主要介紹了
微信小程序wx.request POST获取不到数据解决办法
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
get
? ??//發(fā)起請(qǐng)求
????wx.request({ ??????url: 'http://www.xiaochengxu.com/home/index/curd', //僅為示例,并非真實(shí)的接口地址 ??????method:'GET', ??????data: { ????????title: '123', ????????content: '456' ??????}, ??????header: { ????????'content-type': 'application/json' ??????}, ??????success: function (res) { ????????console.log(res.data) ??????} ????}) post ????//發(fā)起請(qǐng)求 ????wx.request({ ??????url: 'http://www.xiaochengxu.com/home/index/curd', //僅為示例,并非真實(shí)的接口地址 ??????method:'POST', ??????data: { ????????title: '123', ????????content: '456' ??????}, ??????header: { ????????'content-type': 'application/x-www-form-urlencoded' ??????}, ??????success: function (res) { ????????console.log(res.data) ??????} ????}) 解決辦法:修改headder里面的屬性值。轉(zhuǎn)載于:https://www.cnblogs.com/qcjdp/p/11274879.html
總結(jié)
以上是生活随笔為你收集整理的微信小程序wx.request POST获取不到数据解决办法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Web Service 安全性解决方案(
- 下一篇: 大道至简读后感