首页 > 代码库 > Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'name': was expecting ('true', 'false' or 'null')

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

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

Ajax跨域问题

ajax提交添加下面两行代码

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

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

 

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