Try to rewrite thanks.php so that it returns the data you need in case
of success, and in case of error: ie judging from your code, in case
of success of thanks.php should return the following data:

<div id="message" style="display: none;">
  <h2>Contact Form Submitted!</h2>
  <p>We will be in touch soon.</p>
  <img id='checkmark' src='/images/check.png'/>
</div>

and your jQuery code:

$("#myform").validate({
     submitHandler: function(myform) {
        jQuery(myform).ajaxSubmit({
           type: "POST",
              url: "thanks.php",
           success: function(data) {
              $('#contact_form').html(data);
              $('#contact_form').fadeIn(1500);
             });
           }
        });
     }


   Gk___




2009/10/12 HairyJim <james.d...@gmail.com>:
>
> Hi all,
>
> I am making a call to a php file which right at this minute has no
> validation, all validation is been done by the jquery form plugin. I
> post to the thanks file but if the validation (xss prevention soon to
> be implemented) in the thanks fails I want to stop the processing of
> the form i.e. stop the return of success.
>
> How do I do this, any insight appreciated.
>
> Code:
>
> $("#myform").validate({
>      submitHandler: function(myform) {
>         jQuery(myform).ajaxSubmit({
>            type: "POST",
>               url: "thanks.php",
>            success: function() {
>               $('#contact_form').html("<div id='message'></div>");
>               $('#message').html("<h2>Contact Form Submitted!</h2>")
>              .append("<p>We will be in touch soon.</p>")
>              .hide()
>              .fadeIn(1500, function() {
>                 $('#message').append("<img id='checkmark' src='/
> images/check.png' />");
>              });
>            }
>         });
>      }

Reply via email to