Cjax Framework

Iniciating the JavaScript Engine

To initialize the JavaScript library included with Cjax, have the $ajax Object do it for you,


simply in the HEAD of the HTML page do:

<?php echo $ajax->init(); ?>

$ajax->init() will print the script tag of cjax.js.

As of version 5.0-beta, By default the minified version of cjax.js is invoked, but you can change that by passing false in the init function, eg: $ajax->init(false), then the full version would be used.

- OR -

As of 5.0-RC2 you can also do this

<?php echo $ajax->init('http://yoursite/url/here/'); ?>
Where it says "http://yoursite/url/here/" Enter the path where ajax.php is, but withouth the "ajax.php".

- OR - a work around for using init() function -

Simply include file in the head of your HTML document:

<script id='cjax_lib' type='text/javascript' src='cjax/core/js/cjax.min.js'></script>
Make sure that the path is correct. You may want to try to visit it on the browser and that it is actually loading something. If it isn't the the issue is that something on your server is blocking the URL, mod-rewrite.

- OR - Updating your js_path

You can edit your Cjax's cofig file and add the path there.
Open file cjax/config.default.php and rename it to config.php.
Add this setting to your config file:
Note: You js_path may vary, depending on where cjax is located within your site.

->js_path 'http://yoursite.com/cjax/core/js/';


If you use CodeIgniter, cjax will be located in the application/library/cjax directory.

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

CodeIgniter  ·  Copyright © 2006 - 2012  ·  Cjax