I have a form within an iframe that I want to use to refresh the location of the parent. I am using the form to set session variables that are used within the parent.
So in the iframe I have:
<form name="MyForm" method="POST"
action="<?php echo $_SERVER['PHP_SELF'] . '?' . SID; ?>">
And to submit this form I'm using this link:
Which refers to this script:
parent.location.href = "/search_results.php?";
(I think!) my problem is this; it works fine if the MyForm action, i.e. ="<?php echo $SERVER['PHPSELF'] . '?' . SID; ?>", completes before loadParent() is executed but if there is a slight delay in the time it takes for the server to do this, loadParent() is executed too early and the input from MyForm is lost.
What I need is to tell the script to wait until the MyForm action has completed, i.e. the page has refreshed, before running loadParent().
I'm sure there are loads of different ways of doing this. Ideally I would like something that detects the page refresh within the iframe (caused by the MyForm action) and not something that relies on a timed delay loop.
All ideas gratefully received.