Hi All
Im having a mare with something and wondered if someone could help me.
In brief, I am requiring to make 10 requests to a remote server to extract an object.
My problem is that my requests are occurring too quickly and i want to slow the process down.
I thought i could use a timer in my ajax call but for some reason, the timer runs only on the first ajax call which is defined in the each
so my code is
Code:
$('ul#sortable2 li').each(function(index) {
var toFill = $(this);
$.ajax({
type: 'POST',
url: "http://localhost/25-things-web/grooves/renderPlayer",
async:true,
data: { list : '27754583' },
success:function(data){
setTimeout( function() { toFill.html(data); },10000);
},
error:function(){
}
} );
});
each li should pull the object and render it but i want to be able to define a time between each ajax call and render the results in between
My timeout runs at the start of the each but not after each each.
Any ideas
this is really a pain and a probl;em for me.
Cheers
Steve
|