CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript frameworks (http://www.codingforums.com/forumdisplay.php?f=62)
-   -   history.back() and jquery question (http://www.codingforums.com/showthread.php?t=282925)

shaunthomson 11-25-2012 06:30 AM

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.

itborg 11-25-2012 09:13 AM

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...

DanInMa 11-25-2012 02:01 PM

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

shaunthomson 11-25-2012 09:33 PM

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.'/');


All times are GMT +1. The time now is 07:29 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.