Replacing entire page with ajax response from a frame

I hope this is the correct forum for my question. If not I apologize
and I ask that someone direct me to a more appropriate forum. (I have
posted to the PHP list and to SO, but have not gotten a working
solution from either.)

I have a web page like this:


<html>
   <head>
      <title>Main </title>
   </head>
   <frameset frameborder=1 border=1 rows="140,*">
      <frame src="mainheader.php>
      <frameset frameborder=1 border=1 cols='75%,25%'>
         <frame src="main.php" name="main">
         <frame src="selection.php" name="selection">
      </frameset>
   </frameset>
</html>

>From the selection frame I send an ajax request. The response contains
a complete new page and I want to replace the existing page with the
response.

If I do:

document.open();
document.write(response);
document.close();

or:

var newDoc = document.open("text/html", "replace");
newDoc.write(response);
newDoc.close();

The new content is rendered within the frame the request originated from.

I then tried:

top.document.body.innerHTML = response;

and

parent.document.body.innerHTML = response;

In both case the entire doc was replaced, but only the top frame was
rendered. If I look at the page source everything is there, and if I
just hit return in the address bar all the frames are rendered. What
would prevent it from rendering all the frames when I do the
assignment?

Thanks!
-larry

Received on Thursday, 9 January 2014 00:01:20 UTC