I have a problem with jquery ajax call on form submission. As I don't want my page to be refreshed when submitting a form, I do e.preventDefault()
Unfortunately this causes all the client side model data annotation validation not to be displayed. It is very important to me to display all the model validation at a client side.
Does anyone know a way of doing so? If I prevented some default behavior, how do I turn on the validation? Any help would be appreciated
$(function () {
var form = $('#basicForm');
form.on('submit', function (e) {
e.preventDefault();
$.ajax({
cache: false,
async: true,
type: "POST",
url: form.action,
data: form.serialize(),
success: function (result) {
// for testing
alert("success");
}
});
});
});