datatables ajax data processing code example
Example 1: send data in datatable ajax
$('#datatable').DataTable({
order: [],
responsive: true,
autoWidth: false,
processing: true,
serverSide: true,
ajax: {
url: AJAX_URL,
data(d) {
d.parameter_name_1 = 'value';
d.parameter_name_2 = 'value';
}
},
columns: [
{
---}
]
});
Example 2: before send datatable options
var table = $('#example').DataTable();
table.on( 'draw', function () {
alert( 'Table redrawn' );
} );
This could also be written as:
$('#example').on( 'draw.dt', function () {
alert( 'Table redraw' );
} );