The below code will turn the table with an id of tableid
into a DataTable, as well as return a DataTables API instance:
$(document).ready(function() {
$('#tableid').DataTable();
});
Compare this to the below code, which will turn the table into a DataTable but will not return a DataTables API instance:
$(document).ready(function() {
$('#tableid').dataTable();
});
See the DataTables API documentation section for more details on what can be done with the DataTables API instance.