title: jQuery Ajax (beforeSend and complete) working properly on FireFox but not on IE8 and Chrome
body: <p>I am using jQuery ajax version 1.4.1 in my MVC application (though the issue I am discussing was same with the old jQuery version 3.2.1) as well, to check during customer registration if the username is already registered. As the user clicks on the "Check Availibility" button, I am showing a busy image in place of the check button (actually hiding the check button and showing the image) while checking the availibility on the server and then displaying a message. It is a Sync call (async: false) and I used beforeSend: and complete: to show and hide the busy image and the check button. This thing is working well on Firefox but in IE 8 and Chrome, neither the busy image appear nor the check button hides rather the check button remained pressed as the whole thing has hanged. The available and not available messages appear correctly though. Below is the code:</p>
  
  <p>HTML in a User Control (ascx):</p>
  
  <pre><code>&lt;div id="available"&gt;This Username is Available&lt;/div&gt;
  
  div id="not_available"&gt;This Username is not available&lt;/div&gt;
  
  &lt;input id="txtUsername" name="txtUsername" type="text" size="50" /&gt;&amp;nbsp;
  
  &lt;button id="check" name="check" type="button"&gt;Check Availability&lt;/button&gt;
  
  &lt;img id="busy" src="/Content/Images/busy.gif" /&gt;
  </code></pre>
  
  <p>On the top of this user control, I am linking an external javascript file that has the following code:</p>
  
  <pre><code>$(document).ready(function() {
  
      $('img#busy').hide();
      $('div#available').hide();
      $('div#not_available').hide();
  
      $("button#check").click(function() {
          var available = checkUsername($("input#txtUsername").val());
  
          if (available == "1") {
              $("div#available").show();
              $("div#not_available").hide();
          }
          else {
              $("div#available").hide();
              $("div#not_available").show();
          }
      });
  });
  
  
  function checkUsername(username) {
  
      $.ajax({
  
          type: "POST",
  
          url: "/SomeController/SomeAction",
  
          data: { "id": username },
  
          timeout: 3000,
  
          async: false,
  
          beforeSend: function() {
  
              $("button#check").hide();
  
              $("img#busy").show();
  
          },
  
          complete: function() {
  
              $("button#check").show();
  
              $("img#busy").hide();
  
          },        
  
          cache: false,
  
          success: function(result) {
  
               return result;
  
          },
  
          error: function(error) {
  
              $("img#busy").hide();
  
              $("button#check").show();
  
              alert("Some problems have occured. Please try again later: " + error);
  
          }
  
      });
  
  }
  </code></pre>