Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'name': was expecting ('true', 'false' or 'null')

报错原因:发送的 json object 不符合 json 规范,后台无法解析。(Ajax跨域问题?)

解决方法:

ajax提交添加下面两行代码

contentType:‘application/json;charset=utf-8‘
data:JSON.stringify(数据)

var allData = {
          name:"张三",
          age:20
         };
$.ajax({ type: "POST", url: "xxxx", contentType:‘application/json;charset=utf-8‘, data:JSON.stringify(allData), success: function (data) { alert(data); } });

http://www.mamicode.com/info-detail-1721637.html
posted on 2018-09-27 16:58  YKKKK  阅读(412)  评论(0编辑  收藏  举报