tedd's Demo of timed and rotated text using php and ajax
The following is how this all works, please follow:
- The web page upon loading calls a javascript timer;
- which sends an ajax request to a php script (slave.php) to compute an angle ($a) for a new graphic to be created;
- which sends a request to back to javascript to replace a portion of the DOM (i.e., DOM scripting) with a new HTML img statement: (i.e., <img src="graphic.php?a=$a>);
- which in turn causes the browser to call the graphic.php script to generate and deliver the new graphic.
This cycle is repeated as per the settings in the javascript timer.
This how html can use javascript to execute a php script and return something generated (i.e., image) via ajax.
The HTML entitled id="x" (view source) is the DOM that is changed by Ajax and PHP after this page as loaded. Please note, viewing this source code will not show what has happened.
|
|