视图:
@foreach($list as $v)
//在每一条数据的前面加上input框value值是id
{{$v['id']}}{{$v['wzname']}}{{$v['xwxq']}}{{$v['fl']}}{{$v['xxly']}}@endforeach
视图js:
$('#pl').click(function () {
var id='';
$('input:checked').each(function () {
id+=$(this).val()+',';
})
$.ajax({
type:'get',
url:"{{url('/xwpl')}}",
data:{id:id},
success:function (str) {
// alert(str);
}
})
location.reload(0);
})
控制器:
public function xwpl(){
//print_r($_GET);
$id=rtrim($_GET['id'],',');
//print_r(count($_GET));die;
$sql=DB::delete("delete from xw where id in ($id)");
if($sql){
echo 'ok';
}else{
echo 'ok';
}
}