Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

122
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda