我已经在使用这个插件了。在这里,我尝试使用remote
概念,它也成功验证,但submitHandler
函数无法正常工作。(alert("submitHandler");
未提醒)
注意:如果我使用remote
概念,则无法提交此表单。
没有remote
概念正常工作。
$(document).ready(function () {
$("#add-ingredients-form").validate({
rules: {
ingrediants_barcode: {
required: true,
remote: {
url: "ajax-check-product-name.php",
type: "post"
},
},
product_name: {
required: true,
remote: {
url: "ajax-check-product-name.php",
type: "post"
}
},
brand_name: { required: true },
quantity: { required: true },
unit: { required: true },
expiry_date: { required: true }
},
messages: {
ingrediants_barcode: {
remote: "Ingrediant barcode already in use!"
},
product_name: {
remote: "Product name already in use!"
}
},
submitHandler: function (form) {
alert("submitHandler");//Not working
form.submit();//Not working
}
});
});
如果我使用remote
概念,则无法提交此表单。请更新我错误的地方。
感谢All!