JS部分
var orderNosList = new Array();var rows = $("#dg_linkOrder").datagrid("getChecked");if(rows.length < 1){$('#error').dialog('open').dialog('center').dialog('setTitle', '錯誤提示');$('#error').text("請選擇一條資料");}else {for (var i = 0; i < rows.length; i++) {orderNosList[i] = rows[i].orderNo;}var params = {reserveOrderNoList:orderNosList };$.ajax({url : api.LINK_ORDER_RESERVE_RETRY,data : JSON.stringify(params),type : 'POST',contentType: "application/json",dataType : 'json',success : function(res) {var str = '';$(res.reserveFlowList).each(function(i, obj){var responseCode = obj.responseCode;var orderNo = obj.reserveFlow.orderNo;if (responseCode == 0) {str += "訂單號為"+ orderNo +"成功<br/>";} else {str += "訂單號為"+ orderNo + obj.responseMsg +"<br/>"}});$('#error2').dialog('open').dialog('center').dialog('setTitle', '提示');$('#error2').html(str);// 重新整理列表linkOrder.unfresh_LinkOrder();}});}
var demo = new Object();demo.name="1";demo.id="2";var demo2 = new Object();demo2.name="1";demo2.id="2";var conditons = [];conditons.push(demo);conditons.push(demo2);$(function(){ $.ajax({ type:'post', url:'/http/pss/demo', contentType: "application/json", data:{name:"123",conditions:JSON.stringify(conditons)}, dataType : 'json', success:function(data){ console.log(data); }, error: function (XMLHttpRequest, textStatus, errorThrown){ alert("error"); } });});
JAVA後端
@RequestMapping("/http/pss/reserveOrderRetry")@ResponseBodypublic Object reserveOrderRetry(@RequestParam("reserveOrderNoList")List<String> reserveOrderNoList) {return service.reserveOrderRetry(reserveOrderNoList);}
@RequestMapping("/http/pss/reserveOrderRetry")@ResponseBodypublic Object reserveOrderRetry(@RequestParam("conditions")List<Demo> conditions, @RequestParam("name")String name) {}