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

143
Visualizações
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
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