I'm developing an application in ASP.NET MVC 5 and I have a problem in putting a modal load while the form is saved, because when there is something invalid in the form the javascript does not respect, showing the loading mode, I would like know how to get the Dynamic ModelState to release the modal only when it is true, thus avoiding showing the modal wrongly.
I'm trying to use it this way without success:
$('#salvar').click(function () {
var isValid = ${ViewData.ModelState.IsValid};
if (!isValid) {
waitingDialog.hide();
} else {
waitingDialog.show('Salvando Chamado...');
}
});