This is driving me nuts for a while now. I have an ajax
call like so:
function update()
{
$.get("update.php", function(data)
{
$("#output-progress").html(data);
});
}
And I call it like so:
window.setInterval(function()
{
update();
}, 2000);
}
Then I have another calc function which is also called:
function calc()
{
$.get("calc.php", function(data)
{
//whole bunch of lines to re-render page
});
}
So the idea is that while calc()
is running, the update()
will periodically update a div on the progress.
However what is happening is that if I open the console and check the calls to update()
is triggered every 5 seconds, but they just stall and they complete only after the calc()
has returned. I first thought this was a browser/jQuery
issue, but if I log both the functions into separate log files in PHP then the update()
gets logged only after the calc()
finishes!
Im not sure what is going on here, any pointers are greatly appreciated!