How do I reload a parent tab after closing an iframe?
OK made progress. I now have the iframe successfully calling a function in the "parent" using
parent.reloadtab ();
Parent function:
function reloadtab ( )
{
$('#tabs').tabs('load', 2);
}
Trouble now is rather than just reloading the third tab, it appears to reload all of the tabs, and put the focus back on the first tab. This same function call works perfectly fine when the javascript is called from within the page rather than an iframe. Any ideas?
_________________________________________________________________________________
I am relatively new to javascript/jqueriy. I open an iframe which updates various information in the database. Once the close button is clicked, I close the iframe. Once it closes, I want to reload the tab which calls a php script which gets the new database info and reload the page.
The tab I want to refresh is setup with the code:
<li id="personaltab"><a rel="index" href="insidetab.php"><span>A Tab</span></a></li>
To open the iframe I have the code:
function wbpimanageinsiders ()
{
var node;
if (document.getElementById)
{
node = document.getElementById("manageiframe");
if (node)
{
var myElement = document.createElement("DIV");
node.appendChild(myElement);
myElement.innerHTML =
"<iframe src='manageinsiders.php' " +
"width='450' height='300' scrollbars='yes' frameborder='5' marginwidth='30'></iframe> " ;
}
else
{
alert("The function insertIframe could not find " +
"the tag iframediv.");
return;
}
}
else
{
alert(" document.getElementByID failed. " );
return;
}
}
And finally the script to close the iframe. I've tried all kinds of permutations of the following and can't get anything to work. The iframe closes, but the tab does not reload. This also has an undesired side effect of deleteing the div tag so if the click the button again, it errors out. Reloading the tab should eliminate this side effect.
function closemanageiframe ()
{
window.parent.document.getElementById('manageiframe').parentNode.removeChild(window.parent.document.getElementById('manageiframe'));
window.parent.$('#tabs').tabs('reload', 2);
}
<input style="align: center" type="button" value="Close" onclick="closemanageiframe();