我试图在Bootstrap Validator验证表单后使用AJAX提交表单。它由于某种原因不起作用。我怎样才能让它发挥作用?如何在提交表单之前进行确认框?
$('#accountUpdateForm form').bootstrapValidator({
femphasized texteedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
'firstName': {
validators: {
notEmpty: {},
}
},
'lastName': {
validators: {
notEmpty: {},
}
},
},
submitHandler: function(form) {
alert("Submit Handler");
var frm = $('#accountUpdateForm');
frm.submit(function(ev) {
$.ajax({
type: 'POST',
url: frm.attr('action'),
data: frm.serialize(),
cache: false,
success: function(data, textStatus, jqXHR) {
alert('Changes saved');
}
});
ev.preventDefault();
});
}
});