Page 1 of 1

endless loop reloading parent of iframe?! Why? :(

Posted: Wed Apr 19, 2006 8:44 am
by robster
Hi there, I'm having some trouble with endless loops when I try and exit my iframe and relod its parent file... Here is the quite nested list of files.


Code: Select all

POS.php
|
|
--includes MAIN_POS.PHP
	|	
	|
	--includes POS_IFRAME_LIST.PHP
		|
		|
		--includes POS_IFRAME_CONTENTS.PHP
			|
			|
			--includes POS_TRANS_EDIT.PHP
What happens is the pos_iframe_list.php file includes the pos_iframe_contents.php file in an iframe.
The pos_iframe_contents.php file has an edit button, that when pressed, calls via form data, pos_trans_edit.php. After pos_trans_edit.php does its thing to the database it wants to refresh the complete pos.php file so other data on that page can now be updated with the new changed data in the database.

When I try and do with javascript this, I either get:

A)looping refresh of the iframe -- parent.document.location.reload();
B)looping refresh of the whole page -- window.parent.location.reload();
C)no refresh -- lots of other javascript tried here



Can anyone give some suggestions? I'd really appreciate it.


Rob

Posted: Sat Jun 03, 2006 8:03 pm
by robster
I'm still having trouble here. It's something that's becoming the thorn in my side :)

In logical sense, if I tell the last include to reload its parent, then that should be fine, as the parent is the CONTENT of the iframe itself. What I need I guess is to reload the root parent!

Does anyone know how I can do that that (reload POS.php from POS_TRANS_EDIT.php)?

Cheers,

Rob

Posted: Sat Jun 03, 2006 8:43 pm
by Burrito
you might try something like:

Code: Select all

top.location.reload();

Posted: Sat Jun 03, 2006 9:03 pm
by robster
Thanks for that, it still made it loop though. I finally got it with this:

Code: Select all

echo <<<JS
<script language="JavaScript">
parent.history.go(-1);
parent.window.reload();
</script>  
JS;
It goes back in history, but that's not a problem as it reloads the page. That means any old data that was on that page gets refreshed from the database on the reload.

PHEW! that took way too long LOL :)

rob

(thanks again)

Posted: Sat Jun 03, 2006 9:10 pm
by robster
no, I take it back :)

Actually, it is going back in history, but not reloading the parent... sigh...

Posted: Sat Jun 03, 2006 9:13 pm
by robster
LOL, talk about trial and error!!!

:)

Code: Select all

echo <<<JS
<script language="JavaScript">
top.location = "pos.php";
</script>  
JS;

works.. done... dusted... over n out :)