首页 > 微信 > 详细

微信小程序 wx.request

时间:2018-03-06 13:31:23      阅读:280      评论:0      收藏:0      [点我收藏+]

一:问题

微信小程序 post请求时,服务器后台接受不到data里面的数据的bug。

二:解决办法

wx.request({
        url: ‘http://xxxxxxxxx/Create‘,
        method: ‘POST‘,
        data: {
          "userid": userid,
          "way": way,
          "specificWay": specificWay,
          "money": money,
          "dateTime": e.detail.value.date + ‘ ‘ + e.detail.value.time + ‘:‘ + second,
          "notes": e.detail.value.notes,
        },
        header: {
          "content-type": "application/x-www-form-urlencoded"
        },
        success: function (res) {
          console.log(res.data);
        },
        fail: function (res) {
          console.log(res);
        }
      })

在header里面添加一行代码:

 header:{
          "content-type": "application/x-www-form-urlencoded"
        },

 

微信小程序 wx.request

原文:https://www.cnblogs.com/MzwCat/p/8513702.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!