Load data with AJAX, but not on initializing table.
Load data with AJAX, but not on initializing table.
postitief
Posts: 22Questions: 9Answers: 0
I have a datatable where data should be loaded with AJAX. But the data should not be loaded when the table is initialized. When a specific event is happening (eg button click), the data must be loaded by AJAX.
With
$('#table').DataTable().draw();
I can get the data in the table.
But how to prevent the data to be loaded directly on init (page load)?
$('#table').DataTable({
serverSide: false,
ajax: { url: '/path/to/data'},
columns: [
{data: 'id', name: 'p.id'},
// ...
]
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
So what I basically need is
deferLoading
but withserverSide
on falseYou could do something like this - set the URL later and just load the data then.
Colin
Sweet! That did the job! Tnx!