Files
Inventario_material_v1/js/main.js
T
2019-01-14 19:48:35 -06:00

48 lines
1.3 KiB
JavaScript

jQuery(document).on('submit','#formlg',function(event){
event.preventDefault();
jQuery.ajax({
url: 'login.php',
type: 'POST',
dataType: 'json',
data: $(this).serialize(),
beforeSend: function() {
$('.botonlg').val('Validando...');
}
})
.done(function (respuesta) {
console.log(respuesta);
console.log("afuera de if");
if (!respuesta.error){
console.log("despues de error");
if (respuesta.tipo == 'Jefatura')
{
//location.href = '132.248.80.188/Inventario/sitio/admin/admin.php';
console.log("jefatura");
}
else if (respuesta.tipo == 'Area')
{
location.href = '132.248.80.188/Inventario/sitio/usuario/usuario.php';
}
}
else{
$('.error').slideDown('slow');
setTimeout(function () {
$('.error').slideUp('slow')
},3000);
$('.botonlg').val('Iniciar Sesion');
}
})
.fail(function (resp) {
console.log(resp.responseText);
})
.always(function(){
console.log("complete");
});
});