How do I automatically update hundreds of images in an HTML page using jquery?
Posted
by Chris
on Stack Overflow
See other posts from Stack Overflow
or by Chris
Published on 2010-05-30T13:57:24Z
Indexed on
2010/05/30
14:02 UTC
Read the original article
Hit count: 169
JavaScript
|jQuery
I have an HTML page where I want to refresh a lot of images every 30 seconds after the HTML page has been downloaded. I understand how to do this with Jquery and a single image, but I want to use about 200 custom urls to determine the current image to display for over 200 images. I need to find an efficient way to have jquery call the custom url associated with each image to download the url for the needed image as it changes, and then update the image in the page when it changes.
Current hyperlink example to demonstrate the custom urls.
<A href="/urlThatReturnsCurrentImageURL/1234/4567">link to url for image</A>
Each custom url will return an image tag like this (or any other text that makes this simpler for jquery)
<img src="/static/someImage.jpg">
What is the simplest way to have jquery call the custom url for each image to download the image url, image html, or some other text that jquery can use to download the right image every 30 seconds? Please keep in mind that I will have about 200 of these on a page.
© Stack Overflow or respective owner