亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

Content type not supported

后段可以接收到請求并且插入數據庫。但是。返回的時候就報錯
2021-06-16?20:35:41.508??WARN?6105?---?[nio-8088-exec-1]?.w.s.m.s.DefaultHandlerExceptionResolver?:?Resolved?[org.springframework.web.HttpMediaTypeNotSupportedException:?Content?type?'application/x-www-form-urlencoded;charset=UTF-8'?not?supported]

然后去postman里模擬請求,設置了Content-Type,后端不會報錯。這是為什么呢?

$.ajax({
????????url:data.form.action,
????????async:false,
????????type:'POST',
????????dataType:"json",
????????cache:false,
????????contentType:'application/json;charset=utf-8',
????????data:JSON.stringify(data.field),
????????success:function(res){
????????console.log("ccccc")
????????????if(res.code==0){
????????????????layer.closeAll();
????????????????query();
????????????}else{
????????????????layer.alert(res.msg);
????????????}
????????},error:?function(err){?????????
?????????}
});


正在回答

2 回答

我的課程中,這個方法是套在了layui的提交方法之中的,并且最后返回false,返回false是阻止表單跳轉,你看看你是不是那么做的。

0 回復 有任何疑惑可以回復我~

請問解決了嗎?


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

Content type not supported

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號