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

151
Vistas
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 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