I have the following scenario in a HTML web page, using Firefox 31.0. A frameset containing frames, and a button that does some evaluation/functionality. My problem is I want to reload one of the frames after submitting a POST form. See picture for general layout of the frames.
The HTML-Form in frame "edit" look like:
<form name="edit_this" id="edit_this" action="http://example.com" method="post">
<input type="hidden" name="fnc" value="" id="fnc">
</form>
The button HTML looks like this one:
<button onclick="process('uninstall');">Uninstall All Modules</button>
<!-- this line is used to try a javascript reload in the function below-->
<a id="reload" target="base" href="http://example.com" />
The javascript function called look like:
function process(fnc) {
document.getElementById('fnc').value = fnc;
document.getElementById('edit_this').submit();
// none of the following work
document.getElementById('reload').click();
top.base.src="http://example.com";
top.base.location.reload();
}
All three ways of loading the frame fails for some reason, eg the
document.getElementById('reload').click();
(re)loads the frame "base" and it's sub-frameset properly but the POST data seems not to reach the server. It seem's the "click()" execution interrupts the previous POST. Network tracking with firebug show's the POST request remains unreplied by server, but the subsequent "click()" request ist managed properly.
and for
top.base.src="http://example.com";
the processing on the server happend, but the frame is not reloaded (at all) and remains unchanged.
and the
top.base.location.reload();
is a major problem, as it's going to send the POST data again, which is not applicable to application logic.
I've tried these with no avial, maybe some one knows how to deal with it.
Thank you.
Update: I've found a possible solution to the problem by using setTimeout like so:
setTimeout(function(){document.getElementById('reload').click();}, 200);
this give's the client/server time to respond to POST and works fine, but It seem's bit hackish, eg. what happend under heavy-load scenarios, will be 200ms enough?, etc... So my question is still open, I guess.