Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

121
Visualizações
How to validate with a password form data in database

I have an ajax code to save the form data in DB, all working properly, but my client need validate it with a qr code before to perform this action, so I added a modal to request the password with an input, but I don't know how to stop the ajax process until validate the password filled in the input...

Here the code:

$("#myForm").submit(function(event){
    event.preventDefault();
    $('#validateInput').modal('show');  //show modal with the input
    
$.ajax({
    type: "POST",
    url: "include/validation.php?ts=" + new Date().getTime(),
    success: function( response ){
        if(response == 1) {
    
            $.ajax({
                type:"POST",
                url:"include/save.php?ts=" + new Date().getTime(),
                dataType:"text",
                data:$(this).serialize(),
                beforeSend:function(){
                    $("#loading").show();
                    $("#result").empty();
                    $('#submit').attr("disabled", true);
                },
                success:function(response){
                    $("#loading").hide();
                    $("#result").append(response);
                    setTimeout(function(){
                        $('#submit').attr("disabled", false);
                    }, 3000);
                },
                error: function(response){
                    $("#loading").hide();
                    $("#result").append(response);
                    setTimeout(function(){
                        $('#submit').attr("disabled", false);
                    }, 3000);
                }
            });
        } else {
            swal({
                type: "error",
                title: "is not valid",
                text: "try again...",
                timer: 1000
            });
        }
    },
    error: function(response){
        $("#loading").hide();
        $("#result").append(response);
    }

});
});   
about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda