批量删除的写法

<th>全选<input id="ckAll" type="checkbox"  #nclick="QuanXuan()"/></th>

 <td><input class="ckc" type="checkbox"  value="@item.PId"/></td>

 

<script>
    //全选
    function QuanXuan()
    {
        $(".ckc").prop("checked",$("#ckAll").prop("checked"))
    }
    //批量删除
    function PLDelete()
    {
        var arry = new Array();
        $(".ckc:checked").each(function () {
            arry.push(this.value);
        })
        if (confirm("确定要删除吗?"))
        {
            $.ajax({
                url: "/ErShi/PLDelete/"+arry.toString(),
                type: "post",
                success: function (data)
                {
                    if (data>0) {
                        alert("删除成功!");
                        location.href = "/ErShi/Index";
                    }
                }
            })
        }
    }
</script>

 

posted on 2018-08-22 15:56  菜鸟兵  阅读(330)  评论(0)    收藏  举报

导航