data.json
data.json
kkambi
Posts: 2Questions: 1Answers: 0
Hi There, I used the below ajax function to reload my table every 3 second to show latest updated data from my database; My code is as follows but it does not work. I dont know where is data.json coming from. please can someone help me. My table id is ****getdata****.
var table = $('#getdata').DataTable( { ajax: "data.json" } ); setInterval( function () { table.ajax.reload( null, false ); // user paging is not reset on reload }, 3000 );This discussion has been closed.
Answers
That
ajax
option just points to wherever your data is. So ifdata.json
is where your JSON data that you want to update is, then that is where you would point it. If it is something else, use a different URL.Allan
Now i have replaced data.json with my page containing the table as below but still not refresh table. Am i missing something here? Please help me accomplish this. thank.
var table = $('#getdata').DataTable( {
ajax: "refreshtable.php"
} );
setInterval( function () {
table.ajax.reload( null, false );
}, 3000 );
If you post a link to the page showing the issue, I'd be happy to take a looks and help debug it.
Allan