how to keep the display on the current slide [javascript slider] after submit button is pressed
Situation:
I have a webpage utilzing a jav开发者_如何学编程ascript slider [tiny slider from scriptiny dot com].
I created a contact form on the last slide with jquery validation and php validation. Everything works fine EXCEPT for: After clicking on Submit, the webpage displays the first slide. Not sure hot to make it stick to the contact "slide".Site navigation is done using a string like:
onclick="slideshow.pos(0)
onclick="slideshow.pos(1)
onclick="slideshow.pos(2)
onclick="slideshow.pos(3)
onclick="slideshow.pos(4)
I need the contact "slide" to stay on "slideshow.pos(4)".
Code:
//If there is no error, send the email
if(!isset($hasError)){
$emailTo = 'myemail@gmail.com'; //Put your own email address here
$body = "Name: $name \n\nEmail: $email \n\nSubject: $subject \n\nComments:\n $comments";
$headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
mail($emailTo, $subject, $body, $headers);
$emailSent = true;
}
How can I do this? Ideally, I would be able to run some javascript after the email is sent making the refresh of the page send the user to "slideshow.pos(4)"??
Any help would be appreciated,Mark
You can "submit" your data with an Ajax call and avoid the page from refreshing in the first place. If you never used Ajax take some time to look at https://developer.mozilla.org/en/ajax.
精彩评论