codehaven - php snippets - coding help
Generic filters
Exact matches only

Poll/query a database every 10 seconds – ajax loop

25th October 2014

Jquery - Ajax

jquery icon

Show live data from your database.. (or nearly!)

and testdata.php can be a mysql query in a php page or a text file if needed.

It will have all the php query’s and the answer from each one is added to an array and then echoed out at the end as an array or jsonencoded. Therefore will be processed and the answer to whatever would have been output to the screen is echoed back.

Was this code snippet helpful?