I need to refresh a php script every ten seconds, it is for a update system, It looks for any new updates and then returns a value to javascript/php and then in displays them to the user in a div?
Is this the best way, if not what is?
i’m open to all comments.
Thanks in advance.
set up your AJAX call to the php script within a JS function, and the last line of the function should be
setTimeout(functionname, 10000);oh, and, you’ll need to call the function the first time somewhere, then it will continue to run…so:
Here’s some sample code to show you how you could pass JSON or XML and have the HTML page handle it. Here’s the PHP (here the data is just hardcoded, but in your case you’d dynamically populate):
and then here is a sample html page: