Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

120
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!