I am creating a simple script where a form is submitted, and the result of form submission is redirected to an iframe.
I want js code to check if the iframe has finished loading the form submission result completely, and only then retrieve the content of that iframe and post it to me in a form post.
I have the code to retrieve the content of iframe, as well as code to send form post, I just need a way to determine if the new page loaded into the iframe, has finished loading or not. I would like to wait for the loading to be complete, and only then retrieve content of that iframe and post it.
Also I would like a simple javascript function to submit all forms in the web page in main window of web browser.
You can use an event listener for when the document is ready in Chrome and FF, but IE doesn’t support that. Instead, IE has something called readystate that you can handle the change event of. Below are the functions that should handle everything you need to add the event handler. You’ll want to call addLoadHandler, the rest are supporting functions.
As for submitting all forms on the page. You just need to call .submit on each. The below code will do that: