Cjax Framework


Ajax Controllers

An ajax controller is a php file with a class that handles ajax requests. The ajax controller allows you to consolidate all your ajax requests to a single place of origin. An ajax controller has also Cjax pre-loaded. You can easily start creating more functionality right from your ajax controller. All Cjax functions will work on an ajax controller as they work when you first load tha page. This powerful feature lets you continue interacting with the server back and forth, using the same type of logic. Ajax controllers not only let you serve ajax requests, but it also can generate further actions, right from the back-end. For example, from an ajax controller you can create ajax requests, update elements on the page, issue triggers. Anything else you can do on the page load, you can also do in an ajax controller, you can even use Cjax plugins from an ajax controller. Imagine having this power, on every ajax call you make!.


An ajax controller is automatically called when you route your ajax requests through file ajax.php.

Example

URL: ajax.php?Controller/Method

The url above will load a file called Controller.php inside the controllers directory, and will trigger a method called 'Method'.
PHP
<?php 

    
//controllers/Controller.php
    
class Controller {

        function 
Method()
        {
            
$ajax ajax();
        }
    }

?>

Previous Topic:  Previous Class    ·   Top of Page   ·   Demos Home   ·  

CodeIgniter  ·  Copyright © 2006 - 2012  ·  Cjax