AjaxCore
AjaxCore 1.3.1 HelpDocs - onLoad Bind Example

onLoad Bind Example

This is a simple example file to check out the AjaxCore framework.

In this case we will use onLoad with Bind to execute a PHP function when the page loads, on this example the PHP function is getRandomNumber defined in class AjaxTest.class.php. So when the page is loaded, 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.

onLoad Method's parameter list

bindto: is the name of the PHP function what will be called.
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
request: optional - support all previous bindings options, bind, bindTimer, bindPeriodicalTimer. Default bind
timerms: optional timer expiration time in milliseconds (only for timer requests). Default 300 ms

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.