Julicun
Joined: 21 Jun 2013 Posts: 2
|
Posted: Mon Nov 04, 2013 11:19 pm Post subject: Catch email validation on server side |
|
|
Hello,
I'm submitting my contact form with ajax after validating with jquery plugin. The ajax submit triggers a paypal form submission, which is hidden on the same page and which redirects to paypal.com.
I have removed mycontactform.com php validation off all form fields except "email" (it's not possible right?) but if "email" is invalid through mycontactform.com validation, the paypal form submission and redirection is fired even though but without the ajax (mycontactform).
This is my submithandler:
submitHandler: function() {
$.post($("#contactForm").attr("action"), $("#contactForm").serialize(), function(data) {
$('#submit_btn').html(data);
if(data == 'FAIL'){
alert("Invalid email address");
} else {
$("#paypal").submit();
}
});
return false;
}
I'm looking for the send.php (mycontactform) echo that results from an invalid email input, something like this:
if(mail($invalid)){
echo "FAIL";
}else{
echo "success";
}
I 'm supposing that I could include the correct echo to if(data == 'FAIL'){ alert("Invalid email address"); and catch it before being redirected to paypal without mycontactform submission.
For any help, thank you! |
|