I want to make a slideshow on my site, but the problem is that the setInterval works only one time. It loads my file only one time end then stops.
Heres the code: m
There problem is not the setInterval
, it's the caching of the image. When the image tag is loaded, it looks exactly like the one before. The browser doesn't load the image again, it just uses the one that is already loaded.
If you want to load the image again, change your rotate.php
to include a counter or random number as parameter in the URL, returning something that for example looks like this:
By changing the URL each time the tag is loaded, the browser has to load the new image each time.