On Thu, Jan 9, 2014 at 11:15 AM, Tedd Sperling <tedd@xxxxxxxxxxxx> wrote: > Larry: > > You don't replace the entire page -- you fill-in the portion needed. > > What you are missing here is DOM scripting. > > The Ajax portion sends a GET request to a php script (get.php) that does all the db heavy work which in turn repopulates a "myspan" div, like so: > > (index.php) > > <div id="myspan"> <!-- start of myspan --> > <?php include("get.php"); ?> > </div> <!-- end of myspan --> > > The get.php script has all the database stuff including the $_GET[] that brings in the state, city, and zip values. > > Based upon what is provided, get.php script pulls the data from the db and populates the select controls with what is needed. > > There is no refresh of the index page, but rather just an update of the "myspan" div via get.php. Tedd- I understand how your code works. My application is slightly different. My page looks 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 within the selection frame I call your makeRequest function with mainframes.php. I get back a complete new page. I got this to work by doing this: top.document.childNodes[0].innerHTML = response; This works on FF, Chrome, and Safari, but on IE it fails with: SCRIPT600: Could not set the innerHTML property. Invalid target element for this operation. Still googling for a solution for that. > On Jan 8, 2014, at 5:17 PM, Larry Martell <larry.martell@xxxxxxxxx> wrote: > >> On Sat, Dec 14, 2013 at 7:00 AM, Tedd Sperling <tedd@xxxxxxxxxxxx> wrote: >>> On Dec 9, 2013, at 3:40 PM, Larry Martell <larry.martell@xxxxxxxxx> wrote: >>> >>>> Is there any way in php to have a function be called when the value of >>>> a listbox selection changes? >>> >>> Larry: >>> >>> Sure, take a look at this: >>> >>> http://php1.net/a/zipcode-states/ >>> >>> Everything except the database is there -- you as you may. >> >> Tedd- >> >> Thanks very much for this. I just got around to trying it, and I >> adapted it for my needs and it's basically working. The one issue I >> have is that my request returns a complete new page and I want to >> replace the existing page with that. The problem is that the request >> originates from a frame and when I try and replace the page with the >> response the new page get rendered within the frame. Do you know how >> to replace the entire page with the response? >> >> I've tried: >> >> document.open(); >> document.write(response); >> document.close(); >> >> and: >> >> var newDoc = document.open("text/html", "replace"); >> newDoc.write(response); >> newDoc.close(); >> >> But I got the same undesirable results from both. >> >> I realized this is not really a PHP question, but I wanted to continue >> this thread here as others could benefit from it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php