I have the following jquery to validate the input data of a login, but I show the msj and the page is reloaded and the false return and e.preventDefault () does not do its function.
$('#btnlog').closest('form').on('submit', function (e) {
e.preventDefault();
$('#btnlog').attr('disabled', true);
this.submit(); // ahora hace el submit de tu formulario.
var email = $('#email').val();
var contraseña = $('#contraseña').val();
if (email == '' || contraseña == '') {
e.preventDefault();
$('#msjviewbag').empty();
$('.espacio').hide();
$('#btnlog').attr('disabled', false);
$('#errorlog').html('Los Campos No Deben Estar Vacios');
return false;
}
if ($('#email').val() != '') {
if ($('#email').val().indexOf('@@', 0) == -1 || $('#email').val().indexOf('.', 0) == -1) {
e.preventDefault();
$('#msjviewbag').empty();
$('.espacio').hide();
$('#btnlog').attr('disabled', false);
$('#errorlog').html('El Formato de Email No es Correcto');
return false;
}
}
});