So i have looked around and most of the code for this looks needlessly beefy. I am looking for lightweight ajax code that refreshes a div with an action like:
load('boo.php')
And I need it to load first on the page opening (ie no delay) then every x seconds refresh (without fade) so you cannot notice a change unless my Database rows have updated but I can do the db bit.
I think i would need something like:
onreadystatechange
to load when the page loads? Eh im not too sure on this 🙁 any help would be much appreciated!
Thanks!
I totally recommend using some library for cross-browser support and tested code, e.g. jQuery.
With jQuery, it’s as simple as
You can wrap this in a function and call it on document ready, then use
setIntervalas suggested by @M1K1OUpdate
To run the code when the DOM is loaded, the jQuery API documentation for ready states that
Here is a complete example: