I am adding an animated gif, which is a loading bar. Gif is defined earlier in the code, and then I just do the following.
document.getElementById("loading").style.display = "inline";
//some if statements.
do_ajax(params);
The ajax call looks something like this ...
var uri = getURL(params);
var xhr = new XMLHttpRequest();
xhr.open("POST",uri,false);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
xhr.send(null);
to show gif loading. Then I do some checks (if statements) followed by an AJAX request. However, the gif freezes while this code is executing, and only begins to "move" after the code completes. Why is this? How to fix this problem?
I am using Chrome 11
source
share