I am wondering whether this is possible:
I have a page. The user clicks a link and that calls a PHP script. The PHP script returns true or false.
Depending on the true or false, I was hoping to be able to toggle a div.
I am wondering whether I need to do it the AJAX way? How do people usually accomplish this?
Seems pretty common.
I am using this YUI library already:
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.8.2r1/build/reset-fonts-grids/reset-fonts-grids.css&2.8.2r1/build/base/base-min.css">
Yes, very easy, no need for Ajax. Here’s two ways:
Using straight PHP:
Or, using inline Javascript (in the PHP script), assuming you have a
<div id='targetDiv'>in your HTML, and a$testVarin your PHP:The second method can be easily altered to degrade gracefully.