这是我的代码,可以完美地完成远程验证。但是表格不会提交。当我检查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')
}
},
});
}
});