PHP to do away with iframe.

I have looked and looked through different threads and sites. I do know basic PHP and have been learning more and more but I just can’t figure this out.

I have a site that has a structor of:

Flash header with nav.
Content in frame
Footer

What I would like to do is do away with the iFrame and use PHP and Ajax to load a page into the center of the page without reloading the header or footer. When the site is visited the first time it loads the “main.html” file into the iFrame and when a button is clicked in the flash header it loads a new page into the iFrame without reloading the entire page. The url never changes due to the iFrame, I would like it to change with the page if I can make it do that. Even if it’s something like “index.php?pageid=contact_us.”

How would I accomplish this with PHP/ Ajax?
Thanks in advance!

First of all, if you want to change the url, it is possible only if u reload the page or navigate to different page. Even with Ajax, u cannot change the url in the address bar.

Second, if ur header buttons are in flash, they should call a javascript function. if you can manage that, use the following ajax code in that javascript function.

function ajaxLoader(pagetoload) {
var oXMLHTTP;
if (window.XMLHttpRequest)
var oXMLHTTP = new XMLHttpRequest();
else if (window.ActiveXObject)
var oXMLHTTP = new ActiveXObject(“Microsoft.XMLHTTP”);

var sURL = pagetoload;
oXMLHTTP.open( “POST”, sURL, false ); oXMLHTTP.send(sURL);
document.getElementById(“container”).innerHTML = oXMLHTTP.responseText;
}

now here this function takes the page name to load, as a parameter and receives the response content of the page. which is loaded into a div (or table td) whose id is set to “container”.

NOTE: this is not a flash script… this javascript function has to be in a webpage (which usually carries the flash header).

Sponsor our Newsletter | Privacy Policy | Terms of Service