1 /*前台往后台传参数时,可以这样写*/ 2 var chessId = "123"; 3 var i=0; 4 5 var data = []; 6 7 /*添加单个参数*/ 8 data.push({name:"type",value:"分配"}); 9 data.push({name:"id",value:chessId}); 10 11 /*循环添加集合参数对象*/ 12 data.push({name:"myList["+i+"].mid",value:"234"}); 13 data.push({name:"myList["+i+"].num",value:5}); 14 i++; 15 16 $.ajax({ 17 type:"get", 18 url:"xxx", 19 data:data, 20 async:true, 21 }); 22 23 /*后台既可以用对象接收,也可以,直接用 字符串接收,如下*/ 24 25 @ResponseBody 26 @RequestMapping("xxx") 27 public void controlFunction(String type,String id,List myList){ 28 29 } 30