title: Make rows in DataTables clickable
body: <p>I am trying to make the rows in my DataTable clickable. On click I want to navigate the user to another page.</p>
  
  <p>When I execute the script and click on the rows the script always navigates me to <code>./test/data.php?id=1</code> which is the page I want to use for the first row. The same script is active in all the rows.</p>
  
  <p>Does someone know why my script is pasting the link for the first row in all the rows and how I can fix this?</p>
  
  <p>Here is my script:</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
       $( document ).ready(function() {
        $('#grid1').DataTable({
         "bprocessing": true,
         "serverSide": true,
              "ajax": {
                  "url": "response2.php",
                  "type": "POST",
                  "error": function(){
                      $("#grid_processing").css("display","none");
                  }
              },
              "columnDefs": [ 
                  { "targets": 1, "render": function ( data, type, full, meta ) { return  '&lt;b&gt;'+data+'&lt;/b&gt;'} },
                  { "targets": 3, "render": function ( data, type, full, meta ) { return  '&lt;i&gt;'+data+'&lt;/i&gt;'} },
                  { "targets": 6, "render": function ( data, type, full, meta ) { return  '&lt;a href="./test/data.php?id='+data+'"&gt;&lt;/a&gt;'; } }               
              ]                       
        });   
       });
      &lt;/script&gt;
      &lt;script type="text/javascript"&gt;
      $(document).ready(function() {
  
          $('#grid1').click(function() {
              var href = $(this).find("a").attr("href");
              if(href) {
                  window.location = href;
              }
          });
  
      });
      &lt;/script&gt;
  </code></pre>
  
  <p><strong>Edit 1:</strong></p>
  
  <p>response2.php:</p>
  
  <pre><code>&lt;?php
      include_once("connection.php");
  
      $params = $columns = $totalRecords = $data = array();
      $params = $_REQUEST;
      $columns = array( 
          0 =&gt; 'name',
          1 =&gt; 'address',
          2 =&gt; 'number',
          3 =&gt; 'city',
          4 =&gt; 'country',
          5 =&gt; 'id'
      );
  
      $where = $sqlTot = $sqlRec = "";
  
      if( !empty($params['search']['value']) ) {   
          $where .=" WHERE ";
          $where .=" ( id LIKE '".$params['search']['value']."%' ";
          $where .=" OR name LIKE '".$params['search']['value']."%')";
      }
  
      if (!empty($where) ) {
  
     $where .= "AND user_id='1' ";
      } else {
       $where .= "WHERE user_id='1' ";
      }
  
      $sql = "SELECT name, address, number, city, country, id FROM customers ";
      $sqlTot .= $sql;
      $sqlRec .= $sql;
      if(isset($where) &amp;&amp; $where != '') {
  
          $sqlTot .= $where;
          $sqlRec .= $where;
      }
  
      $sqlRec .=  " ORDER BY id DESC LIMIT ".$params['start']." ,".$params['length']." ";
  
      $queryTot = mysqli_query($conn, $sqlTot) or die("database error:". mysqli_error($conn));
  
  
      $totalRecords = mysqli_num_rows($queryTot);
  
      $queryRecords = mysqli_query($conn, $sqlRec) or die("error to fetch employees data");
  
      while( $row = mysqli_fetch_row($queryRecords) ) { 
          $data[] = $row;
      }   
  
      $json_data = array(
              "draw"            =&gt; intval( $params['draw'] ),   
              "recordsTotal"    =&gt; intval( $totalRecords ),  
              "recordsFiltered" =&gt; intval($totalRecords),
              "data"            =&gt; $data
              );
  
      echo json_encode($json_data);
  ?&gt;
  </code></pre>