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 的地图