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

142
Views
Form validation not working after adding ajax (update)

I was trying to add an ajax to submit the form without refreshing the page. Eventhough I added the "required" on HTML input tags, it is not validating that. I can submit the form without any values. But when I remove the ajax it worked fine.

<form action="mail.php" method="POST" id="signup">
           <input id="form_name" type="text" name="companyName" class="form-control" placeholder="Company" required>
           <input id="form_phone" type="tel" name="tele" class="form-control" placeholder="Number" required>

ajax

<script>
  $(document).ready(function(){
  $('#submit-btn').click(function(event){
   // console.log('submitted')
    event.preventDefault();
    $.ajax({
      type : "POST",
      url : "mail.php",
      data : $("#signup").serialize(),
      success : function(data){
       success();

        console.log(data)
      }
  })
  });
});
    
</script>

Can anyone help me with this? I appreciate your time.

about 4 years ago · Juan Pablo Isaza
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!