这是我的代码,它可以按照预期完美地进行远程验证。但是表格不会提交。当我检查 chrome 调试器时,没有调用提交表单。当我删除远程验证规则时,表单已提交。当我删除远程规则并用其他基本必需规则替换时,表单确实提交了。没有错误消息很难看出我做错了什么。谁能指出我正确的方向?
$("#register_student_2").validate({
rules: {
relationship: {
required:true,
remote: {
type: "POST",
url: "includes/check-relationship.php",
data: {
fieldData : function() {
return $("#relationship").val();
}
},
dataType:"json",
dataFilter: function(data) {
var json = jQuery.parseJSON(data);
if(json.error == "true") {
return "\"" + json.errorMessage + "\"";
} else {
return success;
}
}
}
},
},
submitHandler: function (form) {
$(form).ajaxSubmit({
beforeSubmit: function () {
$('html, body').animate({
scrollTop: 0
}, 'slow');
$("#reg-output1").html('output some html');
},
clearForm: true,
success: function (data) {
var msg_parts = data.split("|");
if (msg_parts[0] == "success") {
$("#reg-output1").html('output some more html');
$('#li_complete_registration').removeClass('disabled');
$("#complete_registration").attr('href','#href_complete_registration');
} else {
$("#reg-output1").html('output even more html')
}
},
});
}
});