使用$.each(function(){});可以得到checkbox 中對應的值,
在ajax上傳的時候需要把 traditional 設置爲 true
$('.but_delet_choice').click(function(){ var $check_boxes = $('input[type=checkbox][checked=checked][id!=check_all_box]'); if($check_boxes.length<=0){ alert('您未勾選,請勾選!');return; } if(confirm('您確定要刪除嗎?')){ var dropIds = new Array(); $check_boxes.each(function(){ dropIds.push($(this).val()); }); $.ajax({ type:'post', traditional :true, url:'${ctx}/discuss/dropMoreRmb', data:{'dropIds':dropIds}, success:function(data){ refreshRmb(1); } }); } return false; });