Jump to content

jQuery, loading animation - how to hide again, after loading is finished?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
bmett

bmett

    Newbie

  • Members
  • PipPip
  • 12 posts
Hello everyone,

I use teh following code to show a div ('loading_image') while a form response is loading:

jQuery('#form').submit(function() {

        jQuery('#loading_image').show(); // show animation

            $(':submit',this).attr('disabled','disabled');

            return true; // allow regular form submission

        });
This works fine, but I have the following problem:
The result page is on the same page. It shows up fine, after the form has been submitted. But if you go back from there via the browsers back button, the form shows up as it should but, the loading animation is still there.
How do I get rid of the loading animation, after the form is finished loading?

Hope someone has an idea?

Cheers
Bjorn

#2
NastyDevil

NastyDevil

    Learning Programmer

  • Members
  • PipPipPip
  • 90 posts
cookies would be my guess.

#3
Guest_johnny.dacu_*

Guest_johnny.dacu_*
  • Guests
I can't understand. You have there a function attached to a form submit event. But if you don't have an ajax behavior you'll end up with a refresh a guess so... what's the point of hiding?

#4
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
So this is not with AJAX but a response.redirect from the server-side happening?