title: Form submit is not showing success message
body: <p>I am having a problem with my contact form where there is no success indication being given, even though the message is successfully sent to email. The form appears broken to the user because the page is unchanged when the submit button is pressed. This page was built using a Themeforest template, but the author is unable to provide a solution. I was hoping that someone could point me in the right direction.</p>
  
  <p>Here is the stock 'contact-send.php' file I was given:</p>
  
  <pre><code>&lt;?php
  
  
  $names = $_POST['names'];
   $email = $_POST['email_address'];
   $comment = $_POST['comment'];
   $to ='to@email.com';
  
   $message = "";
   $message .= "*Name: " . htmlspecialchars($names, ENT_QUOTES) . "&lt;br&gt;\n";
   $message .= "*Email: " . htmlspecialchars($email, ENT_QUOTES) . "&lt;br&gt;\n";
   $message .= "*Comments: " . htmlspecialchars($comment, ENT_QUOTES) . "&lt;br&gt;\n";
   $lowmsg = strtolower($message);
  
   $headers = "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\n";
   $headers .= "From: \"" . $names . "\" &lt;" . $email . "&gt;\r\n";
   $headers .= "Reply-To: " .  $email . "\r\n";
   $message = utf8_decode($message);  mail($to, "Note from the Contact Form", $message, $headers);
  
   if ($message){
          echo 'sent';
   }else{
        echo 'failed';
   }
  ?&gt;
  </code></pre>
  
  <p>This is the stock html code:</p>
  
  <pre><code>        &lt;form id="contact-form" name="contact-form" action="" method="post"&gt;
              &lt;label class="contact-label"&gt;Name*&lt;/label&gt;
              &lt;input class="contact-input" type="text" name="contact-names" value="" /&gt;&lt;br /&gt;&lt;span class="name-required"&gt;&lt;/span&gt;
              &lt;label class="contact-label"&gt;Email*&lt;/label&gt;
              &lt;input class="contact-input" type="text" name="contact-email" value="" /&gt;&lt;br /&gt;&lt;span class="email-required"&gt;&lt;/span&gt;
              &lt;label class="contact-label"&gt;Message*&lt;/label&gt;
              &lt;textarea name="comments" rows="2" cols="20" class="contact-commnent"&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;span class="comment-required"&gt;&lt;/span&gt;
              &lt;input type="submit" value="Send"  id="submit-form" class="button lightred contact-submit" /&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>This file is attached to the html pages as well: (juery-contact.js)</p>
  
  <pre><code>$(document).ready(function(){
      $('#submit-form').click(function(){
  
       var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
       var names               = $('#contact-form [name="contact-names"]').val();  
     var email_address = $('#contact-form [name="contact-email"]').val();
     var comment           = $.trim($('#contact-form .contact-commnent').val());
     var data_html ='' ;
  
  
                  if(names == ""){
                       $('.name-required').html('Your name is required.');
                  }else{
                       $('.name-required').html('');
                  }
                  if(email_address == ""){
                       $('.email-required').html('Your email is required.');
                  }else if(reg.test(email_address) == false){
                       $('.email-required').html('Invalid Email Address.');
                  }else{
                       $('.email-required').html('');
                  }
  
                  if(comment == ""){
                       $('.comment-required').html('Comment is required.');
                  }else{
                       $('.comment-required').html('');
                  }
  
          if(comment != "" &amp;&amp; names != "" &amp;&amp; reg.test(email_address) != false){
  
              data_html = "names="+ names + "&amp;comment=" + comment + "&amp;email_address="+ email_address;
  
              //alert(data_html);
  
            $.ajax({
                    type: 'post',
                    url: 'contact-send.php',
                    data: data_html,
                    success: function(msg){
                      if (msg == 'sent'){
                              $('#success').html('Message sent!')     ;
                              $('#contact-form [name="contact-names"]').val('');   
                            $('#contact-form [name="contact-email"]').val('');
                          $('#contact-form .contact-commnent').val('');
  
                          }else{
                              $('#success').html('Mail Error. Please Try Again.!')    ;   
                          }
                    }
              });
  
        }
  
          return false;
      })
  })
  </code></pre>
  
  <p>Here is the live site if you need it: <a href="http://shamrockmasonry.ca/contact.html" rel="nofollow">http://shamrockmasonry.ca/contact.html</a></p>
  
  <p>Any help would be appreciated!</p>