jquery datatable get row data on button click code example

Example 1: jquery datatables get selected row data

var table = $('#example').DataTable();
 
$('#example tbody').on( 'click', 'tr', function () {
    console.log( table.row( this ).data() );
} );

Example 2: datatable get row data

var table = $('#example').DataTable();

$('#example tbody').on( 'click', 'tr', function () {
    console.log( table.row( this ).data() );
} );

Example 3: get row data in datatable

Javascript12345var table = $('#example').DataTable(); $('#example tbody').on( 'click', 'tr', function () {    console.log( table.row( this ).data() );} );