get
// initiate a request
wx.request({
url : 'http://www.xiaochengxu.com/home/index/curd' , // example only, not actual interface address
method:'GET',
data: {
title: '123',
content: '456'
},
header: {
'content-type': 'application/json'
},
success: function (res) {
console.log(res.data)
}
})
post
// initiate a request
wx.request({
url : 'http://www.xiaochengxu.com/home/index/curd' , // example only, not actual interface address
method:'POST',
data: {
title: '123',
content: '456'
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
success: function (res) {
console.log(res.data)
}
})
Solution: Modify the property value headder inside.