Jquery validator 处理ajax表单提交的验证

var validator = null;

$(function(){

 

    validator = $("#***").validate({

            rules:{

                toEmail:{

                    required: true,

                    email: true

                },

                yourEmail:{

                    required: true,

                    email: true

                },

                yourName:"required",

                subject:"required",

                message:"required"

            }

                

        });

 

        $("#***").click(function(){

         submit_refer_by_email();

    })

}

 

function submit_refer_by_email(){

    if(validator.form()){

        alert("submited");

    }

}

 

你可能感兴趣的:(Jquery validator 处理ajax表单提交的验证)