我已经通过其他线程,并使用一个供参考,但仍然无法找到解决方案。
我的问题是:Ajax请求之前的Jquery表单验证
我呼吁按一下按钮的功能,现在该功能验证我尝试后使用Ajax请求提交处理数据之后的验证,问题是我的领域越来越验证,但Ajax请求不调用。
<input type="button" value="Register" id="registerP" onclick="registerPatient()" class="form-control input-sm btn-success ">
function registerPatient(){
$("#patientRegistration").validate({
rules: {
patientName: {
required: true,
textOnly: true
},
},
messages: {
patientName: {
required: "Please enter the full name",
},
},
submitHandler: function(form) {
$.ajax({
type: "POST",
url: "/LoginMavenSpringMVC/appointment/savePatient",
data: "patientName=" + patientName,
success: function(response){},
error: function(e){}
});
}
});
}
但是,如果我不使用验证和直接调用Ajax我能够发布数据。请提出我要去哪里错误。
给予网址或上传完成,这样就可以清楚地看到 –
我不力明白你的意思。 –