I have a "processing..." div overlay that I show with $('').show() prior to making ajax calls and hide on completion. The problem I'm running into is that if I want to show the div and then make several ajax calls prior to hiding the div again it seems to queue the events in Internet Explorer (7) and Chrome (2.0.172.39), but I get the expected result in Firefox (3.0.13). When there's a single ajax call it works fine. The code is something like this:
<div id="foo">processing...</div>
<button onclick="performSingle()" /> <-- This behaves like it's supposed to
<button onclick="performMultiple()" /> <-- This queues the events in IE/Chrome.
<script>
$(document).ready(function(){
$('#foo').hide();
});
function singleAjaxCall() {
$.ajax({
url: ...,
type: "GET",
async: false, //There is a reason for this.
success: function() {}
});
}
function multipleAjaxCalls() {
singleAjaxCall();
singleAjaxCall();
singleAjaxCall();
singleAjaxCall();
singleAjaxCall();
singleAjaxCall();
singleAjaxCall();
singleAjaxCall();
}
function performSingle(){
$('#foo').show();
singleAjaxCall();
$('#foo').hide();
}
function performMultiple(){
$('#foo').show();
multipleAjaxCalls();
$('#foo').hide();
}
</script>