Update and show data real time php ajax

Hello Guys i have a table chart i want to show real time updates on it i am updating table automatic by time countdown when time is less then 0 table will update automatic by using cron job but i want to show real time changes using php ajax

My guess would be that you’d need a javascript timer to query the database table and check for any changes. So every n seconds, have it call a query that determines, as quickly as possible, whether the data you’re displaying has changed, then grab that data and refresh the page.

1 Like

Maybe you should take a look at how web sockets work. When you use the server to notify the browser about the changes you don’t waste your server’s connection with empty responses like using ajax requests in a loop. It’s just like meteor real-time feature. I don’t have a working example on that behavior, but its quite simple to understand the concept.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.