cannot use any ajax functions on datatable table
cannot use any ajax functions on datatable table
Hi, I did follow this doc refference https://datatables.net/reference/api/ajax.reload() but I am still getting error with ajax instance.
$(function () {
var tt = $('#users-table').DataTable({
serverSide: true,
processing: true,
ajax: '/panel/uzytkownicy/data',
columns: [
// my columns
]
});
setInterval( function () {
tt.ajax.reload();
}, 1000 );
});
This is the way how I add DataTable to my project (i am using npm)
window.$.fn.DataTable = require( 'datatables.net-bs4' );
Error is: TypeError: tt.ajax is undefined
DataTables are working perfectly, I can sort, search etc. etc. but im facing problem with ajax api.
Am i importing datatables in wrong way and it is not recognizing api instance in js or what?
Replies
looks like i was importing it in wrong way
i fixed it and topic can be deleted.