I'm running two ajax calls on page load. They both work as expected if I open the page in desktop browser.
However, if I open the same page in an android browser (Chrome for example), I noticed that the second ajax function's response is waiting for completion of the first ajax function which kinda defeats the purpose of asynchronous-ness. Both are executing concurrently, but the second function's success
is only executing after completion of first ajax call's success
function.
Screenshot
The fact that it is working in desktop browsers and not in android browsers leads me to believe that there must be some kind of setting in android which is blocking concurrent asynchronous calls.
If that is the case, is it possible that I can disable that? My code is as follows btw:
$(function(){
var intervalID = window.setInterval(function(){
doAjax(); // this is the function which is waiting for completion of first ajax call
}, 2000);
// the first ajax call
$.ajax({
type:'post',
url:'progress-insert.php', // basically is meant for insertion of records into db
success:function(data)
{
clearInterval(intervalID);
}
});
function doAjax()
{
$.ajax({
type:'post',
url:'progress-update.php', // basically returns how many records have been inserted so far
success:function(data)
{
// do something
}
});
}
});