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

248
Vistas
Continuing submission (using second submit button) of a form after using Ajax to prevent default and do a calculation

I am using Ajax to prevent the default submission of a form and perform a calculation via a post route.

Once the ajax request has been completed, it maybe required to actually submit the form to the back end to continue the process via a second submit button, however this is also caught by the ajax request and it just completes the calculation again.

How can i bypass the ajax function via a secondary submit button and allow the next part of the process if required?

<script type="text/javascript">
    $(document).ready(function() {
      $('#calculator').on('submit',function(e){
        $.ajax({
          data : {
            info1 : $('#searchBox').val(),
            info2 : $('#description').val(),
            info3 : $('#value').val(),
            info4 : $('#length').val(),
            info5 : $('#profile').val(),
          },
          type : 'POST',
          url : '/calculate'
        })
        .done(function(data){
          $('#result').show();
          $('#result1').val(data.data1);
          $('#result2').val(data.data2);
        });
        e.preventDefault();
      });
    });
</script>
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