ajax.reload does not reload?
ajax.reload does not reload?
niceseb
Posts: 2Questions: 2Answers: 0
I tried to modify data content in local exercise_data.json file but nothing happens..
$(document).ready(function() {
var table = $('#example').dataTable( {
"ajax": {
"url": "exercise_data.json",
"dataSrc": ""
},
"columns": [
{ "data": "name" },
{ "data": "city" },
{ "data": "country" },
{ "data": "company" },
{ "data": "job_history" },
{ "data": "email" }
]
} );
//https://datatables.net/reference/api/ajax.reload
setInterval(function () {
table.ajax.reload(null, false);
}, 3000);
//also tried this and also doesn't work - reload is a button on HTML page
$('#reload').click(function () {
table.ajax.reload(function(data){
console.log(data);
}, false);
} );
//also tried
table.ajax.reload();
} );
Or a better way to test the functionality is to generate a random set of numbers so that these changes are automatically passed and refreshed in dataTable?
Anyone?
This discussion has been closed.