See below code, $('#form').valid() is true but data === 'validation_error'.
Anyone could tell me how to debug to find out why I got the validation error even form is valid?
App.SubmitApplication = () => {
$('#form').submit((e) => {
e.preventDefault();
e.stopImmediatePropagation();
if ($('#form').valid()) {
let ajaxOptions = {
beforeSend: () => {
helperApp.BlockUI('js-pnl-application');
},
success: (data) => {
if (data === 'validation_error') {
//show validation error
}
//show SUCCESS
},
error: (xhr, textStatus, errorThrown) => {
//An error happened when saving your data.");
}
};
$('#form').ajaxSubmit(ajaxOptions);
}
})
};