I'm trying to execute a function in the form submit, it works correctly, however if I return true
I need the form not to be sent.
It's being done this way:
$('#FornecedorNovo').submit(function (e) {
var url = "/Fornecedor/VerificaInscricao";
var Insc = $("#InscricaoEstadual").val();
$.ajax({
url: url,
data: { insc: Insc },
datatype: "json",
type: "POST",
success: function (data) {
if (data.resultado == true) {
alert('Já existe esta inscrição estadual cadastrada para outro fornecedor.');
e.preventDefault();
}
}
})
});
But the form is still sent.