I have a requirement where i need to fetch around 50-100 urls using Ajax request and a loop. This is working but, Firefox goes unresponsive and freezes. Is there a way i can implement "go to next url when 1st one completed". Like when - then in jquery or something like that.
data = [url1, url2, url3, url4, url5, url6, ............]
for(i=0; i < 50; i++){
$.ajax({
async: false,
type: 'GET',
url: data[i],
dataType: 'json',
success: function(data){
alert(data);
}
});
}
I will also like to see if we can push, at least 2 URLs together to speed up.
Update :
Reviewed all the solution given below, but nothing worked. Now i am more exicted and looking for a solution which can run 'n' number of AJAX calls without any crash or un- responsiveness