I have an issue with handling the Ajax requests which are triggered in async and are now processing at the backend. I have shown up a div to show the status of the requests. But if the number of requests happens to be more than 100, the browser freezes and chrome throws the dialog to wait or kill pages. If I keep waiting, it will finally give me the desired result but is there any other way to turn around this problem.
A sample of my code here is
This is just a sample function that resembles the need.
$('a').each(function(){
$.get($(this).attr('href'),function(data){
$('body').append(data);
});
});
Any kind of help is appreciated.
100 Requests? That is a horrible design causing a lot more traffic to your server that is needed. Also it is not guaranteed that the requests will come back in the order that you made the call. The calls may render as 1,2,3,4,8,7,6,5,10.
What is killing the browser is not the Ajax calls, it is writing to the DOM over and over again. So you need to rethink that append(data) line.