My Script :
function pagination(id)
{
$("#article_load_destacados").load("indexer_destacados_news.php?pg_d="+id);
if (id+1>2)
{
pagination(0);
setInterval(function()
{
pagination(0);
}, 4000);
}
else
{
setInterval(function()
{
pagination(id+1);
}, 4000);
}
}
</script>
<div id="article_load_destacados"></div>
<script>
pagination(0);
</script>
Create this script for show pagination, the script call PHP file and load this with pagination, for this send different ids and when load PHP file load the same time different elements of pagination. With this script I want run all pagination based on id. If I have for example 5 pages, the script run from 0 to 5, I use for setInterval for it with jQuery.
I want get the script paginate and send different id each 4 seconds.
The problem when run the script the navigator doesn’t work, and generates an infinite loop.
As pointed out you want setTimeout not setInterval, you can also simplify your code http://jsfiddle.net/rayBt/