AjaxCore: PHP Ajax Framework
Written by on November 21st, 2006 in Ajax News.
They keep on coming folks. Mauro Niewolski has created AjaxCore which is “a multi-purpose PHP framework that ease the development of rich Ajax applications, by generating the appropriate JavaScript code. AjaxCore takes all the dirty work of JavaScript code generation and provides a solid foundation. The concept is to extend a Generic AjaxCore class and defining methods that handle the Ajax driven events and binding them to HTML objects. It uses Prototype’s JavaScript standard library for getting DOM (Document Object Model ) elements and handling asynchronous XMLHttpRequest One distinguish point to remark is that, by letting you Bind events on HTML objects that will execute server side code,it let’s you solve any specific requirement without the hassle of coding particular JavaScript code to handle specific events.”
Usage
- bind ( does a bind between a html object and a php function, when a JavaScript event is triggered )
- bindTimer ( does a bind between a html object and a php function, when a JavaScript event is triggered and timer expires)
- bindPeriodicalTimer ( does a bind between a html object and a php function, when a JavaScript event is triggered and keeps repeating each time timer expires).
The key is, just make a class that extends from “AjaxCore” and define a function to handle Ajax requests, and then bind an HTML object to that function upon a JavaScript event ( like onClick and so on..), you can even assign several JavaScript events to the same PHP function with no hassle. Also, If you have to send some HTML elements values to the PHP function, it’s as simple as type the ID of the html element and then retrive it on php with $this->request['elementName'] method, you can even send static values with no HTML ID by appending a (’ _ ‘) prefix to the element, as _XXX=YYY , whether XXX represents variable name, and YYY value.
Mauro has a combo example that has code such as:
Source: Ajaxian
Original Article: http://ajaxian.com/archives/ajaxcore-php-ajax-framework