Initialise DataTable, then make AJAX call to load data
Initialise DataTable, then make AJAX call to load data
This should be easy for those who know it :-)
I'm trying to put my DataTable on the page, wait for my JavaScript routing to figure out what needs to happen, and THEN instruct the table to load its serverside data.
Right now I initialise my table like this
$memberstable = $('#membersdatatable').DataTable({
stateSave: false,
dataSrc: 'memberData',
"ajax": {
"url": "empty.json",
"type": "POST"
},
...
Basically I load an empty file, then a split second later the JavaScript router will call
$memberstable.ajax.url( datafile ).load();
I cannot work out how to init the DataTable without configuring the ajax URL from the start.
If I omit the "ajax" section in the table config then it throws an error.
Any tips appreciated.
This question has an accepted answers - jump to answer
Answers
Looks like I can do this via deferLoading
Thanks :-)