jqgrid如何将json格式的所有rowData发送到服务器?

如何将json格式的jqGrid数据发送到服务器? 我是否必须使用任何外部库或脚本来实现这一目标?

谢谢!

update1 :额外的licensePlateNumber不应该在那里

 [ { "licensePlateNumber": "" }, { "licensePlateNumber": "0000000000000029000721804", "sku": "795127", "description": "", "caseQuantity": "24", "isHeld": "false", "expirationDate": "Jul 22, 2010 12:00:00 AM" }, { "licensePlateNumber": "0000000000000029000722323", "sku": "795127", "description": "", "caseQuantity": "24", "isHeld": "false", "expirationDate": "Jul 22, 2010 12:00:00 AM" }, { "licensePlateNumber": "0000000000000029000722669", "sku": "795127", "description": "", "caseQuantity": "24", "isHeld": "false", "expirationDate": "Jul 22, 2010 12:00:00 AM" } ] 

您从其他问题的方法是可以的,但jQuery.ajax有序列化数组的问题。 我看到的最可靠和标准的方法( 在这里和这里作为例子)将所有jqGrid数据序列化为JSON(例如关于JSON.stringify函数:

 $("#sendButton").click(function(){ var gridData = jQuery("#list").getRowData(); var postData = JSON.stringify(gridData); alert("JSON serialized jqGrid data:\n" + postData); $.ajax({ type: "POST", url: "/cpsb/internalOrderList.do", data : { jgGridData: postData, customData: "bla bla" }, dataType:"json", contentType: "application/json; charset=utf-8", success: function(response, textStatus, xhr) { alert("success"); }, error: function(xhr, textStatus, errorThrown) { alert("error"); } }); }); 

参数jgGridDatacustomData等的名称,你可以选择你喜欢的任何东西。