Can't seem to reload the table (server side data) *Solved*
Can't seem to reload the table (server side data) *Solved*
Hi,
I'm pretty new to javascript/jQuery. So bear with me :)
But I have set up a DataTable with server side using ssp.class.php and that works just fine.
It's setup as follows:
$(document).ready(function() { var table = $('#table').DataTable({ "processing": true, "serverSide": true, "ajax": "data.php" }); });And i have a function that saves new data using ajax. And in the result function of that call I would like to refresh the DataTable. But I just can't figure out how to do it.
I bet it has something to do with my object reference. But since I'm not savvy with JavaScript just can't seem to get a grasp of it.
I have tried multiple things like from within the function that saves the data run:
$('#table').DataTable({
oTable.fnDraw();
});
$('#table').oTable.fnDraw();
table.fnDraw();
table.oTable.fnDraw();
table.oTable(fnDraw());
etc. So can some please guide me in the right direction :)
Answers
Never mind. Stupid me. I solved it, it was to simple.
Just called $('#table').DataTable().draw();