//Form cadastro jQuery(document).ready(function(){ jQuery('#formVaquinha').submit(function(){ $('#bt').prop('disabled', true); $('#bt').val('Processando...'); var dados = jQuery( this ).serialize(); jQuery.ajax({ type: "POST", url: '', data: dados, success: function(data){ alert(data.status); $('#bt').prop('disabled', false); $('#bt').val('CONCLUIR'); } }); return false; }); }); //Form cadastro jQuery(document).ready(function(){ jQuery('#formRegister').submit(function(){ $('#bt').prop('disabled', true); $('#bt').val('Cadastrando...'); var dados = jQuery( this ).serialize(); jQuery.ajax({ type: "POST", url: '', data: dados, success: function(data){ alert(data.description); grecaptcha.reset(); if(data.status=='error'){ $('#bt').prop('disabled', false); $('#bt').val('Cadastrar'); }else{ window.location.href='../../../../dashboard'; } } }); return false; }); }); //Form Login jQuery(document).ready(function(){ jQuery('#formLogin').submit(function(){ $('#bt').prop('disabled', true); $('#bt').val('Entrando...'); var dados = jQuery( this ).serialize(); jQuery.ajax({ type: "POST", url: '', data: dados, success: function(data){ if(data.status=='error'){ alert(data.description); $('#bt').prop('disabled', false); $('#bt').val('Fazer Login'); grecaptcha.reset(); }else{ window.location.href='../../../../dashboard'; } } }); return false; }); }); //Form Recuperar Senha jQuery(document).ready(function(){ jQuery('#formForget').submit(function(){ $('#bt').prop('disabled', true); $('#bt').val('Processando...'); var dados = jQuery( this ).serialize(); jQuery.ajax({ type: "POST", url: '', data: dados, success: function(data){ alert(data.description); if(data.status=='error'){ $('#bt').prop('disabled', false); $('#bt').val('Recuperar Senha'); grecaptcha.reset(); }else{ window.location.href='../../../../'; } } }); return false; }); }); //Definir nova senha jQuery(document).ready(function(){ jQuery('#formUpdate').submit(function(){ $('#bt').prop('disabled', true); $('#bt').val('Processando...'); var dados = jQuery( this ).serialize(); jQuery.ajax({ type: "POST", url: '', data: dados, success: function(data){ alert(data.description); if(data.status=='error'){ $('#bt').prop('disabled', false); $('#bt').val('Salvar nova senha'); grecaptcha.reset(); }else{ window.location.href='../../../../login'; } } }); return false; }); }); function mascara(o,f){ v_obj=o v_fun=f setTimeout("execmascara()",1) } function execmascara(){ v_obj.value=v_fun(v_obj.value) } function mtel(v){ v=v.replace(/\D/g,""); //Remove tudo o que não é dígito v=v.replace(/^(\d{2})(\d)/g,"($1) $2"); //Coloca parênteses em volta dos dois primeiros dígitos v=v.replace(/(\d)(\d{4})$/,"$1-$2"); //Coloca hífen entre o quarto e o quinto dígitos return v; } function id( el ){ return document.getElementById( el ); } window.onload = function(){ id('telefone').onkeyup = function(){ mascara( this, mtel ); } } function mascara_reais() { var elemento = document.getElementById('reais'); var valor = elemento.value; valor = valor + ''; valor = parseInt(valor.replace(/[\D]+/g, '')); valor = valor + ''; valor = valor.replace(/([0-9]{2})$/g, ",$1"); if (valor.length > 6) { valor = valor.replace(/([0-9]{3}),([0-9]{2}$)/g, ".$1,$2"); } elemento.value = valor; if(valor == 'NaN') elemento.value = ''; }