Here's the scenario: - there is a set of variables - these variables indicate the statuses of various equipment - the goal is to display an always-updated status chart
So, I have gotten as far as having a parser in Perl that spits out JavaScript var x = 'y'; type code, and now I'm looking for how to have the HTML or other JavaScript automatically check for updates to this "spit out" code, versus just caching it after the first time.
The closest thing I've seen is to use "setInterval" to have it execute a function, so I went ahead and wrapped the "var" statements in a function with a "setInterval" timer. But will this reliably be always up-to-date, or does it cache the whole function, depending on the browser?
EDIT: I'm not currently using any libraries or anything, and would prefer not to - but I will if I have to.
EDIT2: Finally found what I'm looking for. http://www.philnicholas.com/2009/05/11/reloading-your-javascript-without-reloading-your-page/
Just had to modify the last line to get it to work.
yin your example in the form{"x": "y"}(this is JSON-formatted). Create a function that uses AJAX to asynchronously request this data from that URL. Set the variable on page load, and then re-request it either with asetInterval()request to the same function, or a call to a function that executes it's ownsetImeout()(and calls itself when finished).