Re: one click - two actions?

From: Date: Tue, 14 Nov 2006 21:09:01 +0000
Subject: Re: one click - two actions?
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-244622@lists.php.net to get a copy of this message
Mel wrote:
YES YES! that is exactly what I want. But I don't know how to do what you are suggesting! You'll have to read some documentation about AJAX if that's what you want, but thankfully there are some easy AJAX toolkits out there. Of the ones I've tried, I find xajax (xajax.sf.net) to be the simplest. For example, the following is a rough (completely untested) example that illustrates my point:
In your HTML, you could have: <div id="logoDiv"></div> and <div id="textDiv"></div> somewhere... Then the xajax PHP code: function twoActions() { $xR = new xajaxResponse(); $xR->addAssign('logoDiv','innerHTML','<img src="images/logo.jpg" />'); $xR->addAssign('textDiv','innerHTML','Here is an explanation of the logo!'); return($xR->getXML()); } $xajaxInstance->registerFunction('twoActions'); Then the link: <a href="#" onclick="xajax_twoActions();return(false);">Logo</a> jon

« previous php.general (#244622) next »