我使用 jquery 验证插件来验证我的表单。但仍有一些字段需要自定义验证。
奇怪的是。当提交它时,首先检查我的选择框验证,当这没问题时,所有字段都变成红色,因为 $.validate(); 如果没有填写任何内容,但它仍然继续进行 ajax 调用......这是为什么呢?
我也在使用这个插件: http: //formvalidator.net/#configuration我已经尝试了回调,但由于某种原因它仍然没有返回 false 并继续使用 ajax。
$( "#registration-form" ).submit(function( event ) {
event.preventDefault();
    $.validate();
    //Check dropdown
    if(document.getElementById('foodassoonas').selectedIndex == 0)
    {
    $('#dateerrormsg').html('not ok');
    $("#foodassoonas").css({"border":"1px solid red"});
    return false;
    }
    $.post(jssitebaseUrl+'/ajaxFile.php',{'contactemail':contactemail,'action':'checkOrderEmailId'}, function(output){
        alert(output);
        if(output == 'already' && contactpassword !=""){
            $("#createUserError").addClass('errClass1 margin0');
            $("#createUserError").html('not ok');
            $("#createUserError").show();
            return false;
        }else if(output == 'gotopayment' || (output == 'already' && contactpassword =="")){
            document.checkoutform.submit();
        }
        return false;
    });
return false;
});