Welcome, Guest! Log In | Create Account

PHPulse AJAX Development

From phpulse

Jump to: navigation, search

INTRODUCTION TO PHPULSE AJAX DEVELOPMENT

<<Back | Next>>

As PHPulse has integrated XUL support, it also needed to have integrated AJAX support. Because, after all, what is XUL without AJAX? We do this by interpreting AJAX calls the same way we do regular page calls; that way you make an AJAX call the exact same way you would make a page call. The framework loads the MODEL class, the TYPE MODEL class, the AREA MODEL class, the CONTROLLER class, the AREA CONTROLLER class and the TEMPLATE based upon the AREA/PAGE you are requesting and your privilege level. This limits pages being requested by scripts and cross site scripting attacks.

The AJAX requests are handled by a lightweight javascript class called 'server.js' which is included in your javascripts/ directory. This is currently included in all template_default.tpl files which is the skeleton template for all views. This file CAN BE REPLACED with your own ajax library if you want but you must make sure to include it in the template_default.tpl file to be included in all views.

On each page when we wish to make an AJAX call, we build a custom function which instantiates this class. That function is used for that specific view. Let's take a look at a simple AJAX function in PHPulse in the next section...