title: How to get values of the selected table cell from datatable?
body: <p>This my Jquery:</p>
  
  <pre><code>var oTable_salary = $('#jsontable_salary').dataTable();  //Initialize the datatable
  $("#btn_ca_salary").click(function(){
      $.ajax({
          url: 'proc_php/get_salary.php',
          dataType: 'json',
          success: function(s){
              oTable_salary.fnClearTable();
              for(var i = 0; i &lt; s.length; i++) {
               oTable_salary.fnAddData([
                          s[i][0],
                          s[i][1],
                          s[i][2],
                          s[i][3]                                     
                                 ]);                                      
              } // End For                                            
          },
          error: function(e){
             alert(e.responseText);   
          }
          });
  }); 
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/m0zAZ.png" alt="enter image description here"></p>
  
  <p>I want to get the id from the datable when it is selected. I came up with this but it doesn't work:</p>
  
  <pre><code>$('#jsontable_salary tbody tr').on('click', function (e) {
      e.preventDefault();
      var rowIndex =  $(this).closest('td')[0].text;
      alert(rowIndex);
  });
  </code></pre>