前端代碼:
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后臺(tái)代碼:
@ResponseBody
@RequestMapping("/batchUpdate")
public Map<String,Object> batchUpdate(@RequestBody List<userBean> userBean){
Map<String,Object> res = new HashMap<String,Object>();
res.put("data", userBean); //測(cè)試
return res;
}