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

218
Vistas
How to execute code only after the submission is done?
  1. I have some code from a service called webflow where the form is controlled by them. I write the html form, but the form submission code is handled by a third party not me
  2. I need to run some code (trigger a redirect) after their submission is done.

Here is my attempt

$('#email-form').submit(function (event) {      
    window.location.href = url;
});

It works in some browser, but not in safari. Apparently, this breaks this original form submission code.

My second attempt, this works

    $('#email-form').submit(function (event) {      
    setTimeout(function(){
    window.location.href = url;
    }, 500);

});

By giving it some time, the submission code fires first, then my code runs and successfully redirects.

What is a more robust way of writing this code (not reliant on some random timer wait)?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I think the best way to work this in every browser is 👇

setTimeout(function(){document.location.href = "your link";},250);
about 4 years ago · Juan Pablo Isaza Denunciar
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