Reputation: 445
I'm using the jQuery Datatables for showing a list of logged in people. It contains for each person a cell with the picture, login date/time, name, information. A user can update his profile picture which is shown in one of the cells. The Datatable refreshes every two seconds using the this:
ajax: 'scripts/loggedinlist.php',
setInterval(function(){
mytable.fnReloadAjax('scripts/loggedinlist.php');
}, 2000);
When the user updates his picture, it keeps showing up the old one. I have to clear the browser cache to see the new one.
I tried adding the
cache: false
option and i disabled the google chromes browser caching - still doesn't work.
Does anyone know how to fix this issue?
Thanks!
Upvotes: 0
Views: 862
Reputation: 3832
You can make URL
with img.png?+new Date().getTime()
or as you have lastupdated
field img.png?+lastupdated
that will get solve your problem with image
cache
Upvotes: 4
Reputation: 4997
You can try something like this.
setInterval(function(){
$("#Your_Table_Id").dataTable().fnDraw();
}, 2000);
Upvotes: 1