Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Apr 2013
    Posts
    138
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question show loading icon on form submit?

    Hi, I wrote the following code to show a loading icon when someone submits my form. unfortunately, it doesn't work and there are no errors?!

    here is my code:
    Code:
    <script type="text/javascript">
        $("#loadingicon").hide();
    $('#mainform').submit(function() {
        $("#loadingicon").show();
    });
    </script>

  • #2
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Try this:

    Cancel the default submit.

    Update the display.

    Set a short timeout to submit the form.

  • #3
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    You are submitting the form the standard way, the only thing you can do is add a timeout , then submit the form.

    If you want it to wait until the submittal is completed, you may want to takeover the submit function and use an ajax call while preventing normal form submittal..


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •