Page 1 of 1

what methods are there for automatically updating content?

Posted: Sun Mar 08, 2009 8:22 pm
by nakins
I've been working on a way of updating page content where new information is available to a user while they are using the site/page. I'm sure you know what I'm talking about, but for clarity, I will give the stock quotes as one example, or breaking news, or message/notifier systems as others. I'm currently using a meta refresh tag along with a cookie in a hidden iFrame that runs a script that checks an "updates" table. If updates are found, the script writes some javascript code to the iFrame's document that calls for other Iframes to be reloaded. I think this is better than just reloading the whole page every XX seconds, but I wish I didn't have to run the "check for updates" script and tapping the database every XX seconds from XXX number of users either.

I'm looking to improve what I have, or find a better way. The one problem I have is that I'm in a business intranet environment, and a lot of the machines are kind of old and have minimum ram. So loading a lot of javascipt will just cripple these machines.

So, if you know of anything that might be useful in updating content, I would appreciate any direction or suggestions you might offer.

Thanks

Re: what methods are there for automatically updating content?

Posted: Sun Mar 08, 2009 8:50 pm
by Chris Corbyn
This lends itself perfectly to AJAX. Basically your JavaScript code can call on the server to ask for information about new events, the server responds with either JSON or XML that the JavaScript decodes and interprets. If the response shows that new content is available, have the JavaScript write this out to the page, using the DOM.

jQuery will make all of this easier to achieve :)

EDIT | By the way, this isn't "a lot" of JavaScript code. It would be extremely lightweight.