Hello
I have a webmail form inside a slide toggle panel. Once the mail has been sent, I get the confirmation page thank you messange sent. Works fine. However since the webform is inside the panel, this stays open and actually if i want to send another email I have to refresh the page so that it returns to the webform and does not stay showing the Thank you message.
I thought of including "refresh" page from JQUERY Here is the form that just validates briefly the data input and then issues the Thanks. So I have to embed the code in there, unless someone has a better solution
- $(document).ready(function(){
- $("#submit-form").click(function(){
- $(".error").hide();
- var hasError = false;
- var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
- var formName = $("#name").val();
- var formEmail = $("#email").val();
- var formMessage = $("#message").val();
- var formEscondido = $("#escondido").val();
-
- if(formName == '') {
- $("#name").after('<span class="error">Name required.</span>');
- hasError = true;
- }
- if(formEmail == '') {
- $("#email").after('<span class="error">Email address required.</span>');
- hasError = true;
- }
- if(formMessage == '') {
- $("#message").after('<span class="error">A message is required.</span>');
- hasError = true;
- }
- if( !emailReg.test( formEmail ) ) {
- $("#email").after('<span class="error">Invalid Email entered.</span>');
- hasError = true;
- }
- if(hasError == false) {
- $.post("submitformMT.php",
- { name: formName,
- email: formEmail,
- message: formMessage,
- country:formEscondido
- },
- function(data){
- $("#contact-form").text("Thank You. Your message has been sent." );
-
-
- }
- );
- }
- return false;
- });
- });
I would have to inject something like this
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Reload/Refresh a Page in jQuery</title>
- <script type="text/javascript"
- src="http://code.jquery.com/jquery-latest.js">
- </script>
-
- <script type="text/javascript">
- $(document).ready(function() {
- $('#Button1').click(function() {
- location.reload();
- });
- });
- </script>
- </head>
- <body>
- <input id="Button1" type="button" value="button" />
- </body>
- </html>