BindPeriodicalTimerInline Example
This is a simple example file to check out the AjaxCore framework.In this case we will use a bindPeriodicalTimerInline between an HTML object an a PHP function, on this example the HTML object is the button below, and the PHP function is getRandomNumber defined in class AjaxTest.class.php. So when the button is pressed, a timer starts, and each time it gets to zero, an Ajax request will be made to execute our function and return a random number (as our silly function just return a random number).
Please take in mind that the function executed by the Ajax request, must be defined in one class that extends from AjaxCore class, and therefore extends all Ajax functionality defined in parent class.
Method's parameter list
bindto: is the name of the PHP function what will be called.
timername: is the name of the timer, multiple binds may share the same timer.
timerms: is the milliseconds the timer must waits until it expires.
params: optional - ID of the HTML elements that needs to be send within the request, static values (not html elements ) should be sent as _XXX=YYY , whether XXX represents variable name, and YYY value
id: optional - is the Javascript reference ID for specific behavior defined in setJSCode.
Also you may define several functions in one class and use them from anywhere in your project, and or bind several objects to the same function
Press here to download this page source file, also check the AjaxTest.class.php source file.