I am submitting multiple data multiple times on one button click.
First I submit data to a variable number of hidden iframes (the form is enctype="multipart/form-data"). Then I would like to run the normal submit button/function which redirects the main page.
If i do this all in one function though, I don’t end up recieving all the data I send to the hidden iframes. I believe the redirect begins before the other forms finish sending (sometimes I receive the first data submitted, most of the time I receive none).
I have hacked a solution using setTimeout(function(){$("#submitbtn").click()},3000)… but clearly this won’t always take 3 seconds. I want a way of detecting when it finishes so I can start the submit.
Sorry if this is hard to understand, if you need more info just comment/ask.
I managed to do it by using the IFRAME.load, to detect changes to the target iframes. Once all iframes.load()’s fired I fired the last submit (the one that redirects the main page).