前端代码:
var lps = [];
var l = {"id":"123","name","123"}
var p ={"id":"321","name","321"}
lps.push(l);
lps.push(p);
$.ajax({
url:url,
type:"POST",
dataType : "JSON",
data : JSON.stringify(lps),
contentType: "application/json",
success:function(res){
console.log("55555",res);
}
});
java后台代码:
@ResponseBody
@RequestMapping("/batchUpdate")
public Map<String,Object> batchUpdate(@RequestBody List<userBean> userBean){
Map<String,Object> res = new HashMap<String,Object>();
res.put("data", userBean); //测试
return res;
}