jQuery插件:表单和验证

I have a contact webform that collects a name, email, and message then uses phpmailer to send an email. In order to do some client side validation and provide immediate feedback via ajax, I was looking into jQuery Form Plugin ($form for short) and jQuery Validation Plugin ($validate).

I am a bit confused on how exactly i use these together or if it is even necessary to use both.

$validate's documentation states that using submitHandler function will submit the form via Ajax after it is validated.

$("#myform").validate({
  submitHandler: function(form) {
  $(form).ajaxSubmit();}
});

That example was provided with a link to $form's page and uses the $form method ajaxSubmit().Am I right to assume that this example provided is using the $form plugin? As in this would be somewhere before the above js to prepare the form for Ajax submission.

$('#myForm').ajaxForm();

Or would the better approach be to validate with rules() specified in $validate, and then use $form's ajaxSubmit?

$('#myForm').submit(function() {  
$(this).ajaxSubmit(); 
return false; 
});

lastly, how much server side validation/sanitation with php is necessary afterwards? If $validate allows the form to post, wouldn't i just need to sanitize against xss with:

$name    = filter_var($_POST["name"], FILTER_SANITIZE_STRING);
$email   = filter_var($_POST["email"], FILTER_SANITIZE_EMAIL);
$message = filter_var($_POST["message"], FILTER_SANITIZE_STRING);

Edit: After doing some digging i've found a thread that answers my first question and that the top code fragment will work. However i still don't know if i need to have this declared.

$('#myForm').ajaxForm();

To wrap up this question in order to use both I've found putting

$(form).ajaxSubmit(options);

at the end of jquery validate's

submitHandler:

After any var options will do the trick.