I'm trying to send a few AJAX requests. It has to collect the data into a variable, and after it's done, it has to output the variable. If I don't do it synchronously, it will just output the variable before the requests are done. Is is possible to keep using the page, while the requests are running? The code could look something like this:
for (var i=0;i<10;i++) {
$.ajax({
type: "GET",
url: "http://google.com",
async: false,
data: "",
success:function(data){
total += $(data);
alert(total);
}
}
That should load http://google.com/ 10 times, and output data into a variable called total. It is not my code I use (I like to keep it as private as possible), but only an example.
While it's loading Google 10 times, the page pauses because of async: false. Is is possible to make the page still work, and basically do the AJAX in the background? While it's loading, I can't do anything on the page.