后端接收前端传入的非基本类型对象

it2022-05-05  296

后端接收前端传入的非基本类型对象

前端ajax请求写法

var data = { xxxx:xxxxxxx, xxxxxx:xxxxxx, xxx:xxxxxx, xxx:xxxxx } $.ajax( { type: "post", dataType: "json", //必须的否则HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported contentType: "application/json", data:JSON.stringify(data) , url: "/xx/xxxxx/xxx/xxx", success: function (data) { if(data.result){ alert("新增成功"); initTable(); $("#xxxxxxx").click(); }else{ alert(data.message); } }, error: function () { alert("网络异常,请重试..."); } });

后端接收

public JSONObject Xxxxxx(@RequestBody Xxxxxx xxxxx,HttpSession session){} window['XXXX'+index] = row;

最新回复(0)