views:

295

answers:

2

I have a form where the submit function takes several minutes. I'd like to display an animated gif while the submit is cranking. The code below shows the gif, but it doesn't move. What can I do to get it going?

<script type="text/javascript">

    $(function() {
        $("#submit").click(function() {
            $("#wait").show();
            return true;
        });
    });

</script>

<% Using Html.BeginForm%>
<%-- Various input fields here --%>
<input id="submit" type="submit" value="Submit" />
<img id="wait" src="../../Content/images/ajax-loader.gif" alt="" style="display: none" />
<% End Using%>
+2  A: 

This problem is happening only in IE, correct? Rick Strahl discussed this on his blog some time back. Be sure to read the comments.

Animated GIF images in hidden page elements

Josh Stodola
Hadn't even though about what it was doing in another browser, and sure enough, it works just fine in Chrome. Thanks!
gfrizzle
A: 

Followig Josh's link I was able to get it to work using:

setTimeout('document.images["loadimage"].src = "../Images/loading_bar.gif"', 200);
Tom Sgro