【微信小程序】request请求POST提交数据,记得要加上header

          wx.request({
            url: '*******',
            data: {
              "type":"nearest_village",
              "district": that.data.district,
            },
            header: {
              "Content-Type": "application/x-www-form-urlencoded"
            },
            method: 'POST',
            success: function(res) {
            //do somethind
           }    
         })

一定要带上header,否则数据提交为空。

posted @ 2017-11-02 17:04  PHP急先锋  阅读(20425)  评论(1编辑  收藏  举报