的jqGrid( 'getGridParam', '数据')
提供了一个带有(index,person json)的javascript数组..
result= $('#grid').jqGrid('getGridParam','data');
$.ajax({
type: "POST",
url : "savePerson",
data: JSON.stringify({list:result}),
dataType: 'json',
headers:{
'Accept': 'application/json',
'Content-Type':'application/json'
},
contentType: "application/json; charset=utf-8",
success: function(response){
console.log(response);
},
error: function(jaqXHR, textStatus, errorThrow){
console.log(jqXHR + " : " + textStatus + " : " + errorThrown);
},
fail: function(jaqXHR, textStatus, errorThrow){
console.log(jqXHR + " : " + textStatus + " : " + errorThrown);
}
});
});
如何将其传回控制器?
@RequestMapping(value = "/savePerson", method = RequestMethod.POST)
public @ResponseBody
String savePerson(Model model,
@RequestBody Map<String, Person> list)
出于某种原因
它会一直返回一个带有key =“list”和人员JSON的地图