About the problem that the background post of the applet cannot receive data

The problem that the applet post request cannot get the data

 

Change the value of the headers parameter "Content-Type" to application/x-www-form-urlencoded;

The value of Request Body Type should be URLEncoded from data; if this is not changed, it will not be able to post the value;

write in js like this

wx.request({
      url: host + "/card/create",
      header: { "Content-Type": "application/x-www-form-urlencoded" },
      method:"POST",

      data:{
        'card_no':e.detail.value['card_no']
      },
      success:function(result){
        wx.showToast({
          title: 'The request was successful! ' ,
          icon: 'success',
          mask: true,
          duration: 2000
        })
      }

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325117009&siteId=291194637