0
我正在构建一个使用jquery mobile的小应用程序,并使用jqueryvalidate http://jqueryvalidation.org/进行表单验证。我设法使用ajax进行工作,但只要我将它移入submitHandler:function(form),它仍然“有效”,但我必须单击“提交”两次以使其正常工作?请帮我困惑!
//the validation stuff
$().ready(function() {
// validate new id form
$("#addId").validate({
errorPlacement: function(error, element) {
error.insertAfter(element.parent()); // <- make sure the error message appears after parent element (after textbox!)
},
rules: {
idDesc: "required",
},
messages: {
idDesc: "Please enter a valid description",
},
submitHandler: function(form) {
$('#submit').click(function()
{
$('#addCustId').popup('close');
$.post("Customer_AddNewCustomerId.php", $("#addId").serialize(), function(response)
{
LoadCustomerIdentificationType();
});
});
}
}); //end validate
}); // end function
谢谢:)
啊我看到这让人更有意义!非常感谢,你的回答完美无缺:) – Janey