View Full Version : javascript updating page, Javascript help

26-06-2006, 11:03 AM
Hi all

I currently have a dynamically generated page (php) where my client adds pictures as part of an online course,

What i want is that when the teacher adds a new image (every 5 - 10 mins or so) for the pupils pages to update,

Currently what I have is a meta tag refresh that refreshes the pupils page every 5 minutes

now because the page is dynamically generated (shows the 2 most recent images), i think checking it with javascript would create the same sort of server work as the meta tag refresh, So i had the cunning plan that i could use javascript to check the images directory, and when a new image was added it would refresh the page, or even make a "refresh" button appear on the page
The images are numbered as they are uploaded so the first image uploaded will be image1 the next would be image2 etc,

Now i dont really understand javascript or its abilities, but I thought to tackle this one of 2 ways
get the javascript to check the number of items in the images directory (and store it as a variable), when it increases, the page refreshes
get the javascript to check the most recent creation date in the images directory (and store it as a variable) and when a newer date appears refresh the page

If any one can help i would be exceedingly grateful


26-06-2006, 06:40 PM
Ok even if you don't know how to do this, but you know a good (read idiots) guide to javascript refresh check/function let me know

as I'm reading through dozens of links and not finding it


29-06-2006, 02:24 AM
Not much luck here, eh Nigel?
Maybe a bump would help...

29-06-2006, 04:05 PM
At a guess you probably want to use something like XMLHttpRequest (http://en.wikipedia.org/wiki/XMLHttpRequest).