$(form).ajaxSubmit is not a function

前端 未结 7 1782
猫巷女王i
猫巷女王i 2020-12-02 18:23

I\'m trying to use the jquery validate plugin to validate a form and submit the contents with an ajax request.

This code is in the head of my document.



        
相关标签:
7条回答
  • 2020-12-02 19:13

    Try:

    $(document).ready(function() {
        $('#contact-form').validate({submitHandler: function(form) {
             var data = $('#contact-form').serialize();   
             $.post(
                  'url_request',
                   {data: data},
                   function(response){
                      console.log(response);
                   }
              );
             }
        });
    });
    
    0 讨论(0)
提交回复
热议问题