Answers for "javscript send ajax request only if submit is valid"

0

javscript send ajax request only if submit is valid

$( document ).ready( function(){setupForms();} );

function setupForms(){

    var ajaxOptions = { beforeSubmit:checkForm,
                        success:function(){
                               // the ajax was successful
                       }
                      };

    $( '.ajaxForm' ).ajaxForm( ajaxOptions );   
    $( '.ajaxForm' ).validate();
}

function checkForm(data,form){
    var valid = $(form).valid();
    return valid;
}
Posted by: Guest on January-24-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language