title: check box in datatable ajax processing
body: <p>I have a datatable with ajax processing.I have a checkbox at every row for multiple delete.And also a checkbox on the top to check all the checkbox at once.
  I need to know the checked rows and unchecked to delete.</p>
  
  <p>For example If i select my top checkbox it automatically change all checkbox into checked using this code</p>
  
  <pre><code> $('#select-all').click(function (event) {
          if (this.checked) {
              // Iterate each checkbox
              $(':checkbox').each(function () {
                  this.checked = true;
              });
          } else {
              $(':checkbox').each(function () {
                  this.checked = false;
              });
          }
      });
  </code></pre>
  
  <p>But it only effect for current page I have more than 3000 pages.What will I do?  </p>
  
  <p>JS for server side processing</p>
  
  <pre><code> var dataTable = $('#example2').DataTable({
          processing: true,
          serverSide: true,
          ajax: "?p=online_user_ajax" // json datasource
  
      });
  </code></pre>
  
  <p>JSON return is like this</p>
  
  <pre><code>$i = 1;
  while ($row = mysql_fetch_array($query)) {  // preparing an array
  $actions = '&lt;button class="btn btn-small btn-edit" id="edt_user" &gt;&lt;/button&gt;';
  $checkbox = '&lt;input type="checkbox"&gt;';
  $nestedData = array();
  $nestedData[] = $checkbox;
  $nestedData[] = $i;
  $nestedData[] = $row["email"];
  $nestedData[] = $row["mobile"];
  $nestedData[] = $row["first_name"];
  $nestedData[] = $row["last_name"];
  $nestedData[] = $actions;
  
  $data[] = $nestedData;
  $i++;
  }
  $json_data = array(
  "draw" =&gt; intval($requestData['draw']), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
  "recordsTotal" =&gt; intval($totalData), // total number of records
  "recordsFiltered" =&gt; intval($totalFiltered), // total number of records after searching, if there is no searching then totalFiltered = totalData
  "data" =&gt; $data   // total data array
  );
  
  echo json_encode($json_data);  // send data as json format
  </code></pre>
  
  <p>For better understanding I am adding two images</p>
  
  <p>Checkboxes are checked when I click top checkbox</p>
  
  <p><a href="https://i.stack.imgur.com/qb1tO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qb1tO.jpg" alt="All checkboxes are checked"></a></p>
  
  <p>Checkboxes are unchecked in Second Page</p>
  
  <p><a href="https://i.stack.imgur.com/oXjoe.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oXjoe.jpg" alt="Checkboxes are unchecked"></a></p>
  
  <p>If you have any idea to recover this problem please help.</p>