i have 2 ajax requests in 1 page. i want to run that 2 ajax requests together at same time.
First AJAX
$.ajax({
url: "load1.php",
type: 'POST',
success: function (output) {
console.log(output);
}
});
Second AJAX
$.ajax({
url: "load2.php",
type: 'POST',
success: function (output) {
console.log(output);
}
});
on load1.php
i add sleep(10);
code, so it will delay 10 seconds.
so while i tried to sleep the first ajax
request, the second ajax
will wait 10 seconds for the first ajax until its done.
i know it can be done by using async:false
. but i don't want to use it.
is there another way to prevent it and let the second ajax load without waiting the first ajax?