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
The problem is probably that the browser has loaded random.php into the cache. I think you'd be better off giving each image it's own url and using that. Then a php page can present just the src:
var refreshId = setInterval(function () {
$.get('random-src.php', function (result) {
$('#center>img').attr('src') = result;
},'text');
},5000);
Then random.php could return img/img1.jpg, img/img2.jpg, etc at random.
Alternatively, you could stick header("Cache-Control: no-cache, must-revalidate"); towards the top of your random.php file to prevent the browser from caching.