ajax.reload() does not seem to work in my case
ajax.reload() does not seem to work in my case
alextang
Posts: 9Questions: 2Answers: 0
I have the following code. the alert() box was only displayed once, not every 10 seconds as set. Did I do something wrong?
Alex
$(function() {
var table = $("#datatable").dataTable({
"ajax": {
"url": "{{ url_for('api_get_scheduled_install_status') }}",
"dataSrc": function ( json ) {
alert('test');
return json;
}
}
} );
setInterval( function () {
table.ajax.reload();
}, 10000 );
});
This discussion has been closed.
Replies
found the answer, it should be
table.api().ajax.reload();
The example in http://datatables.net/reference/api/ajax.reload%28%29 does not have the api().
It does if you use
var table = $('#example').DataTable();
(i.e. capitalD
) like in the example, rather than a lowercased
. See: http://datatables.net/faqs/#apiAllan