加上请求头
headers: { 'Content-Type': 'application/json' },
将传输的数据 data 加上JSON.stringify
data: JSON.stringify(data),
let data = {
"cycle": 2,
"emergency": 1,
"name": '我二姐我',
"phone": '15197292392',
"type": 3
}
$.ajax({
url: 'http://47.107.154.85:8001/api/index/demand',
type: 'POST',
data: JSON.stringify(data),
headers: {
'Content-Type': 'application/json'
},
success: function(res) {
console.log(res)
}
});