views:

455

answers:

1

The scenario:

  1. I dynamically create an iframe and a form inside it via JavaScript.
  2. The form is submitted via JavaScript and sends a POST request to a server.
  3. The request is received, but the browser stays on loading status (the progress bar at the bottom of the window keeps progressing and doesn't stop, only happens after form submission).

If I use such an iframe form to POST to somewhere else, this doesn't happen. When trying a regular form not in an iframe, this doesn't happen as well.

So, any idea why this odd phenomenon happens? Or how to stop the browser from the loading status? I tried calling window.stop() from the response to the POST, but to no avail. Setting the frame.src property seems to work, but it comes at a price of an annoying click sound in IE.

Thanks in advance for the help!

+1  A: 

If it's in the loading status before you submit the form: Don't forget to close() the document, if you used write() and writeln() to generate the HTML in the IFORM.

If it's only after submitting the form: Do you return something from the server?

stesch
I don't use write(), I use createElement() and appendChild(). The phenomenon only happens after submitting the form.
Ido Schacham
Oh, and the server returns an empty HTML page (just the bare bones tags).
Ido Schacham