title: Loading indicator after clicking button
body: <p>I'm wanting to show a loading indicator after the user has clicked a button that executes several SQL queries. I tried unhiding a div on button click but that doesn't show up until all the work behind the button is complete. I also tried this solution without success - <a href="http://forums.asp.net/t/1608046.aspx/1" rel="nofollow noreferrer">http://forums.asp.net/t/1608046.aspx/1</a></p>
  
  <p>Any suggestions?</p>
  
  <p><code>code</code></p>
  
  <pre><code>&lt;asp:Button ID="loadButton" OnClientClick="ShowDiv()" runat="server" 
  onclick="loadButton_Click" Text="Go" /&gt;
  
  
  &lt;script type="text/javascript"&gt;
      function ShowDiv()
      {setTimeout('document.getElementById("updatediv").style.display = "inline";', 500);}}
  &lt;/script&gt;
  
  
  &lt;div ID="updatediv" runat="server" &gt;
  &lt;img src="Images/ajax-loader.gif"  /&gt; Updating ....
  &lt;/div&gt;
  </code></pre>
  
  <p><code>code</code></p>
  
  <p>I get the following error when using the linked solution above:
  <img src="https://i.stack.imgur.com/bJMnJ.png" alt="enter image description here"></p>
  
  <p>**This seemed to do the trick</p>
  
  <p><code>code</code></p>
  
  <pre><code>&lt;script type="text/javascript" language="javascript"&gt;
  function ShowDiv()
     $('#updatediv').show() }
  &lt;/script&gt;
  </code></pre>
  
  <p><code>code</code></p>
  
  <p><img src="https://i.stack.imgur.com/E7IcJ.png" alt="enter image description here"></p>