0

From a top page I load a php in an iframe. That php tries to reload a div in the main page with this code.

<script type="text/javascript">
    $(document).ready(function() {
        $('#tnav').load('loadtree.php');
    });
</script>

The top page is called favorites.php. It has an iframe with src=addpages.php. That addpages calls savepages.php. That savepages.php writes the script above. So you have favorites.php -> addpages.php -> savepages.php. The reload for the div which is in the top page (favorites.php) does not happen. The code does appear in the view source for the savepages.php but it appears in the iframe source.

How do I get the reload to happen in the favorites.php? It seems that for the reload to happen the reload script should be appended to one of the other php files. How do I do that? Thanks.

Martine
  • 21
  • 6
  • Anyone know how to specify where the $ function should look for the tnav in $('#tnav').load('loadtree.php');. The function might be looking for tnav in the iframe when it is in the top page. @genesis, @declan you had answers for specifying the script. Do you know what additional arguments should be added to specify in what document tnav. – Martine Jun 26 '11 at 02:37

1 Answers1

0

You're accessing the DOM inside the iframe.

See this answer to see one way to do what you want:

Run JQuery in the context of another frame

Community
  • 1
  • 1
ETWW-Dave
  • 732
  • 5
  • 8