Reputation: 113
I want to get updates from db on a particular time interval or at the time of DB changes. and that will affect on the client web pages insistently
Upvotes: 0
Views: 600
Reputation: 507
you need something like this
function checkUpdate()
{
$.ajax({
url: "/explorer/checkUpdate",// Ajax url to get update
dataType:'json',
type:'post',
data:'',//data required to fetch update from db
success:function(msg){
if(msg.status)
{
// end update
}
else
{
//write code to update html element or add data to list.
setTimeout(checkAndDownload, 3000);
}
}
});
This will continuesly ping server after certain interval so that if any update you can get it.
Upvotes: 0