jquery validation with ajax call

前端 未结 4 1281
闹比i
闹比i 2020-12-06 00:58

I am using the jquery validation and i need to validate an email.

I use

    $(\"#myForm\").validate({
        rules: 
            email: {
                   


        
4条回答
  •  日久生厌
    2020-12-06 01:14

    Well, this works for me...

     $('[id$=txtEmail]').rules("add", { required: true, email: true,
             remote:function(){
                  var checkit={
                      type: "POST",
                      url:  WebServicePathComplete+"VerifyEmail",
                      contentType: "application/json; charset=utf-8",
                      dataType: "json",
                      data: "{'email':'" +$('[id$=txtEmail]').val() + "'}"
                  };
                  return checkit;
             }
      });
    

    note that I have a input with the id 'txtMail'

提交回复
热议问题