一:JQuery部分
function delectNum(){
var checvalue =[];
$('input[name="Fruit"]:checked').each(function(){
checvalue.push($(this).val());
});
//AJAX刷新
$.post("<%=basePath%>standardController/checvalue",
{"id":checvalue}
,function(data){
if(data){
alert("删除成功")
}
},"text")
}
二:HTML部分
<input name="Fruit" type="checkbox" value="1" />
<input name="Fruit" type="checkbox" value="2" />
<input name="Fruit" type="checkbox" value="3" />
<input name="Fruit" type="checkbox" value="4" />
<input name="Fruit" type="checkbox" value="5" />
<input type="submit" value="删除" onclick="delectNum()">
三:controller类
//Service层:业务层
private standardService ss=new standardServiceImpl();
@RequestMapping("/checvalue")
@ResponseBody//jackson注解
public int checvalue(@RequestParam(value="id[]")int[] id){
int count =ss.delecChec(id);
return count;
}