"Allan Sun" <su*****@gmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
This is how I would do it:
1. Insert a iframe with height=0 and border=0 in your php file.
2. In your menu, set the object to be clicked to have the
onClick="url='the_page_in_iframe.php?params=someth ing';frames['your_iframe_i
d'].location.href=url"; 3. In your iframe php file, query the database and get the result, add
them with escape charactor "\" for every thing Javascript needed, clean
the \n .
4. In your iframe php file, write the js as:
parent.document.getElementById('your_main_menu_obj ect_id').innerHTML="<?=
$what_you_just_got ?>";
5. Then you'll see it!
I can give you more codes tommorrow when I get back to my office, if
you feel they are useful.
I would very much like to see how they other people are dealling with
it, coz I even thought it's a bit complex:(
A while back when I was playing around with Flash and AMFPHP, I wrote a
little class that let you retrieve data from a remote server in a manner
similiar to Flash Remoting in a HTML page. Then I promptly forgot about it.
The method used is the same as the one you described, except the iframe is
created dynamically, a post done instead, and the iframe is destroyed when
afterward. This last step turned out to be critical for otherwise the link
to the iframe page will linger in the history, messing up the back/forward
button navigation.
The class let you call a server method with any number of parameters, all of
which can be complex objects. The method can also return a complex object.
The class traps PHP errors, sending messages back to Javascript so you can
throw them up on an alert box. Pretty neat stuff.
I've just put it up on my personal page at
http://www.conradish.net/bobo/
along with a little demo. The class is called Pajama (PHP -> Javascript =
PJ, get it?).