Showing an animated loading icon with jquery and .NET
<p>I have a regular html button that is styled with css that includes a background image.  When the button is clicked it calls a js function which performs a location.href = 'page.aspx'.  Prior to calling that, I would like to swap out the background image of the button.</p>

<p>Here is what I have so far:</p>

<pre><code>function InitiateNewLocalForm(sender, FormGuid) {   
    setTimeout($(sender).attr('class', 'Loading20'), 100);
    location.href = 'Forms/InitializeNewForm.aspx?FormGuid=' + FormGuid
}
</code></pre>

<p>sender is the button that triggered this.
If I remove the location.href part it works fine.  It swaps out the class of the button to Loading20 which has the animated gif as the button background.  However when I run it with the location.href, the animated image does not show up at all.  The class of the button changes and the old background image disappears but the new one does not appear.  I have run into this before in the past and using setTimeout worked.  I'm stumped.</p>

<p>Jason</p>
