请求接口后端提示:JSON parse error: Unrecognized token 'clickLocation': was expecting ('true', 'false' or 'null');
内容:JSON parse error: Unrecognized token 'clickLocation': was expecting ('true', 'false' or 'null'); nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'clickLocation': was expecting ('true', 'false' or 'null')\n at [Source: (PushbackInputStream); line: 1, column: 15]
提示: JSON.parse error,所以是 json 的转化问题。
let obj = { clickLocation: "wx", clickOrigin: "wx" } $.ajax({ type: "POST", url: "http://192.168.3.55:8010/biz/tool/clickStats/addClickNum", dataType: "json", headers: { "Content-Type": "application/json;charset=UTF-8" }, data: JSON.stringify(obj), async: false, success: function (res) { console.log(res, "res"); } })