ajax.reload function is called before table is redrawn

ajax.reload function is called before table is redrawn

PramodhPramodh Posts: 1Questions: 1Answers: 0

I have an async Ajax call made from datatable as source. And on ajax.reload I have a callback function defined.
The callback function is called before the table is redrawn.

function callbackFunction(json) {
console.log(json);
}

var tableSelector = '#qprFSBackupProfilesTable';
var table = $('#table').DataTable({
"ajax": {
"url": "test.php"
},
processing: true,
language: {
"loadingRecords": "",
"processing": "Retrieving data. Please wait..."
}
});

table.ajax.reload(callbackFunction);

The Ajax call takes few seconds to get data from the server. When table.ajax.reload is called the callback prints existing table contents before redrawing the table with new data.

This discussion has been closed.