Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-25-2012, 06:30 AM   PM User | #1
shaunthomson
New Coder

 
Join Date: May 2012
Posts: 88
Thanks: 51
Thanked 0 Times in 0 Posts
shaunthomson is an unknown quantity at this point
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.
shaunthomson is offline   Reply With Quote
Old 11-25-2012, 09:13 AM   PM User | #2
itborg
New to the CF scene

 
Join Date: Nov 2012
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post
itborg is an unknown quantity at this point
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...
itborg is offline   Reply With Quote
Users who have thanked itborg for this post:
shaunthomson (11-25-2012)
Old 11-25-2012, 02:01 PM   PM User | #3
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
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
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Users who have thanked DanInMa for this post:
shaunthomson (11-25-2012)
Old 11-25-2012, 09:33 PM   PM User | #4
shaunthomson
New Coder

 
Join Date: May 2012
Posts: 88
Thanks: 51
Thanked 0 Times in 0 Posts
shaunthomson is an unknown quantity at this point
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.'/');
shaunthomson is offline   Reply With Quote
Reply

Bookmarks

Tags
jquery

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:36 PM.


Advertisement
Log in to turn off these ads.