mercredi 27 décembre 2017

Laravel-use checkbox to display data in datatables using ajax

I want to filter using checkbox, so if checkbox is checked filter data in datatables where data in coulmn "details"= checkbox value and so on

   <input type="checkbox" id="box20" value="slip" >
    <table id="users-table">
     <thead>
     <tr>
      <td>Details</td>
  <td>Description</td>
 </tr>
</thead>
</table>

ajax

  <script type="text/javascript">
    $(function() {
    $('#users-table').DataTable({
        processing: true,
        serverSide: true,
        ajax: 'student/get_datatable',
        columns : [
            {data: 'details'},
            {data: 'Description'},
        ],
    });
    });
  </script>

controller

 public function get_datatable()
  {

    return Datatables::eloquent(Orders::query())->make(true);
  }




Aucun commentaire:

Enregistrer un commentaire