0

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

Sanhosh john
  • 103
  • 2
  • 8
  • was this the one you were looking for or you mean something else? – Dirgh Jan 28 '14 at 05:50
  • thanks for your replay. But would like to get updates like facebook; whatever updates done in our friends that will instantly updated on my timeline . – Sanhosh john Jan 28 '14 at 11:51
  • if you check in the firebug facebook does the same thing... just interval is quite small... – Dirgh Jan 28 '14 at 22:55

1 Answers1

0

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.

user3089273
  • 126
  • 8
Dirgh
  • 507
  • 4
  • 13