Examplessimply 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
Where it says "http://yoursite/url/here/" Enter the path where ajax.php is, but withouth the "ajax.php".
<?php echo $ajax->init('http://yoursite/url/here/'); ?>
- OR - a work around for using init() function -Simply include file in the head of your HTML document:
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_pathYou 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.
$config->js_path = 'http://yoursite.com/cjax/core/js/';
If you use CodeIgniter, cjax will be located in the application/library/cjax directory.