<div class="content_wrapper">

    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>开关列表</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="table-responsive">
                                    <form class="J_ajaxForm" action="#" method="post">
                                        <table id="example" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                            <thead>
                                            <tr>
                                                <th>弹框名称</th>
                                                <th>弹框状态</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <?php foreach($list as $v) { ?>
                                            <tr>
                                                <td><?php echo $v['name'];?></td>
                                                <td>
                                                    <input class='mySwitch' type="checkbox" name="id" aid="<?php echo $v['id'];?>" <?php if( $v['status'] == 1){ echo 'checked';}?> >
                                                </td>
                                            </tr>
                                            <?php } ?>
<!--                                            <tr><td colspan="2"><button type="button" class="btn btn-success formSub J_ajaxSubmitBtn">更新</button></td></tr>-->
                                            </tbody>
                                        </table>
                                    </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>

</div>
<script type="text/javascript">
    $(".mySwitch").bootstrapSwitch({
        onSwitchChange:function(event, state){
            var aid = $(this).attr('aid');
            console.log(aid);
            if(state){
                var state = 1;
            }else{
                var state = 0;
            }
            $.post('switches/actionBullet',{
                id:aid,
                status:state,
            },function (data) {

            })
        }
    });
</script>