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

429
Vistas
Is there a JavaScript equivalent of this where a callback can be used after form-submit - <iframe name="X"> + <form target="X"> + form.submit()?

I have a generic JS file-download function in an application which uses this template to send http POST requests to web handler (ASHX) and download files -

downloadFile(url) {
  // other code ...

  // creates these iframe & form element dynamically
  <iframe name="X" id="X" onload="showErrorInCustomDialogBox()">
  <form target="X" method="post" action="*encodedURL*" ></form>

  // this is called after iframe & form elements are created
  form.submit();

}

On a click of a button in the application, this code gets called and a dialog box opens up asking user a location to download the file. I want to call a function after the user has saved the file.

How can I achieve this same functionality using JS/jQuery and be able to call a function after file-download finishes? What options do I have here? I have tried using XHR but it didn't work out (see my other question).

If something's possible using these iframe + form elements that would be preferable because the way things currently work, when any error occurs during the download, the error message is loaded in the iframe, which is displayed in custom dialog box in the application.

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