<!DOCTYPE html>
<html>
  <head>
    <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
    <link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
    <script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
    <meta charset=utf-8 />
    <title>DataTables - JS Bin</title>
    <style>
    </style>
    
  </head>
  
  <body>
    <div id="left">FILTERS<br>
      First Name:<br>
    <input type="checkbox" id="filter1" value="Gavin">Gavin<br>
      <input type="checkbox" id="filter2" value="Cara">Cara
    
    </div>
    <div class="container" id="right">
      <table id="example" class="display" style="width:100%">
        <thead>
            <tr>
                <th>First Name</th>
                <th>Last Name</th>              
                <th>Position</th>
                <th>Office</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </thead>
        <tfoot>
            <tr>
                <th>First Name</th>
                <th>Last Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </tfoot>
    </table>
    </div>
  </body>  
  
</html>
 
body {
  font: 90%/1.45em "Helvetica Neue", HelveticaNeue, Verdana, Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 0;
  color: #333;
  background-color: #fff;
}
    #left { width: 20%; float: left; }
      #right { width: 80%; float: right; }
 
$(document).ready(function() {
  var table = $('#example').DataTable({
//    "ajax": "/ssp/objects.php",
    "ajax": {
      "url": "/ssp/objects.php",
//      "type": 'POST',
      "data": function(datas) {
        var filter1 = $('#filter1').val();
        var filter2 = $('#filter2').val();
        
        if(filter1)
          datas.filter1=filter1;
          console.log(filter1);
        if(filter2)
          datas.filter2=filter2;
          console.log(filter2);
      }
    },
    "processing": true,
    "serverSide": true,
    "responsive": true,
    "columns": [
      { "data": "first_name" },
      { "data": "last_name" },
      { "data": "position" },
      { "data": "office" },
      { "data": "start_date" },
      { "data": "salary" }
    ]
  });
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers