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 4 of 4
  1. #1
    New Coder
    Join Date
    May 2012
    Posts
    89
    Thanks
    51
    Thanked 0 Times in 0 Posts

    history.back() and jquery question

    Hi

    I want to display a 'loading' gif when someone submits my form (the form submits to another page on the site).

    I've managed to do it, but if someone clicks the browser back button after submitting the form, the loading gif is still displayed...

    Function:
    Code:
    function loadSubmit() {
    $('#progress').show();
    }
    Form:
    Code:
    <form class="form1"action=""method="post"><input type="text"name="c"id="c"onFocus="this.selectionStart=0;this.selectionEnd=this.value.length;"onMouseUp="return false"VALUE="or 'g' to see gig guide"/><input type="image"name="submit"id="submit"height="31"src="images/g.png"style="margin-left:5px" onclick="return loadSubmit()"/></form>
    Is there a way to reset the gif to display:none somehow when you land on the page from the back button.

  • #2
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    6
    Thanks
    0
    Thanked 1 Time in 1 Post
    Which browser do you use?
    How do you set the img display?
    I try your code..
    The image is not show for my when click back...

  • Users who have thanked itborg for this post:

    shaunthomson (11-25-2012)

  • #3
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    ok, because you have no form action, im going to guess you are submitting your form via an ajax call perhaps? if so you need to show and hide your loading gif from within that function.

    if you ar4 submitting via an ajax call of some kind please show it

  • Users who have thanked DanInMa for this post:

    shaunthomson (11-25-2012)

  • #4
    New Coder
    Join Date
    May 2012
    Posts
    89
    Thanks
    51
    Thanked 0 Times in 0 Posts
    Thanks guys - here's some more info...

    1.The image display is:

    Code:
    <span style="display:none;" id="progress"/><img id="progress_image" style="padding-left:5px;padding-top:5px;" src="/i/s.gif" alt=""> Uploading in progress…</span>
    2. I am just using php to submit the form, no AJAX. The php redirects to another page after sanitizing and validating the form:

    Code:
    header('Location: books/'.$a.'/');


  •  

    Tags for this Thread

    Posting Permissions

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