title: jquery ajax loading div not working in IE & Chrome
body: <p>This has been asked many many times. But none of the solutions are working for me in IE and Chrome.</p>
  
  <p>I basically want to show a loading image while ajax call is being made.</p>
  
  <p>Following is what I'm trying.</p>
  
  <pre><code>function ws(){
      showL();
      var res=$.ajax({url:'webservice.asp?service=LoadingTestSRV',async:false,cache:false}).responseText;
      $('#dv').html(res);
      hideL();
      $('#complete').html('Done');
  }
  function showL()
  {
      $('#loading').show();
  }
  function hideL()
  {
      $('#loading').hide();
  }
  </code></pre>
  
  <p>Following is the HTML</p>
  
  <pre><code>&lt;table cellspacing="1" cellpadding="1" border="1"&gt;
    &lt;tr&gt;&lt;td&gt;
          &lt;input type="button" value="ckick" id="btn" onClick="ws();"&gt;
          &lt;input type="button" value="clear" onClick="$('#dv,#complete').html('');"&gt;
      &lt;/td&gt;&lt;td&gt;
          &lt;div id="dv"&gt;&lt;/div&gt;
      &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;
      &lt;td&gt;Here&lt;div id="loading" style="display:none" &gt;Loading.................&lt;/div&gt;&lt;/td&gt;
      &lt;td&gt;final&lt;div id="complete"&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>After above js, I tried </p>
  
  <ul>
  <li>ajaxStart and ajaxStop </li>
  <li>$.ajaxSetup</li>
  <li>$.ajax({...}).done(hideL)</li>
  </ul>
  
  <p><strong>All the js codes I tried are working in Firefox but none of them are working in IE and Chrome.</strong>
  In Firefox, the code works as expected. Loading div gets shown, ajax is called, loading div gets hidden. This is exactly what I'm expecting.
  In IE &amp; Chrome, loading div doesn't show up. Maybe It's getting shown and hidden very fast after or before ajax call.</p>
  
  <p>Please let me know what can be done to make the code work in IE &amp; Chrome.</p>
  
  <p>There has to be some workaround as I've seen other sites show loading div. Or maybe I'm doing something stupid.</p>
  
  <p>Once the code is working in all browsers. I want to make a generic function (like a jQuery plugin) to show a loading div when ajax is being called.</p>