ajax 获取checkbox的值并提交

时间:2015-01-06 22:57:36   收藏:0   阅读:783
$(‘.but_delet_choice‘).click(function(){  
     //获取全选之外的checkbox
      var $check_boxes = $(‘input[type=checkbox][checked=checked][id!=check_all_box]‘);  
                if($check_boxes.length<=0){ 
                    alert(‘您未勾选,请勾选!‘);
                    return;   
                 }  
                if(confirm(‘您确定要删除吗?‘)){  
                    var array_push = new Array();  
                    $check_boxes.each(function(){  
                        array_push.push($(this).val());  
                    });  
                    $.ajax({  
                        type:‘post‘,  
                        traditional :true,  //序列化数据
                        url:‘/post/‘,  
                        data:{‘array_push‘:array_push},  
                        success:function(data){  
                        }  
                    });  
                }  
                return false;  
            });                              

 

原文:http://www.cnblogs.com/druids/p/4207074.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!