I have an index page which has two iframes.
<iframe name="disp" id="dispframe" src="disp.php"></iframe>
<iframe name="type" id="msgframe" src="type.php"></iframe>
Now in type.php which is the bottom iframe, if I type some message and on submit, I want to change a particular div in the top iframe. (basically refresh contents from another file)
I could achieve a refresh by using: (and everytime during refresh, the new content for that div is fetched)
<script type="text/javascript">
parent.disp.location='disp.php'
</script>
But I want to change only a div in disp.php (say with id="loaddiv"). If I was to do it within disp.php itself, I would use something like this:
$('#loaddiv').load('newdisp.php');
Now I want to access loaddiv from the other iframe. I tried some things which didn't work.
$("#dispframe", parent).contents().find("#loaddiv").load("newdisp.php");
I know I'm wrong somewhere. Anybody can help with the right DOM traversal method?