Welcome Guest, Not a member yet? Register   Sign In
Cjax (Ajax Framework) for CodeIgnater v5.1

| There is a new version here: 5.3
| http://ellislab.com/forums/viewthread/229077/

AjaxFw 5.1-Stable is available!

Maintenance Release

Thank you so much for all these that took the time to contact me to let me know about issues you were having, that has helped us to find some hard to find bugs.

If some of you had not taken the time to report these problems I probably would have nothing to release!, be sure to let me know if you find issues or limitations.

Proceed to download


Changes and new Features:

* Support for PHP 5.2

* New usage for Exec events:
$ajax->click($element_id, $actions);
$ajax->change($element_id, $actions);
$ajax->keyup($element_id, $actions);
$ajax->keydown($element_id, $actions);
$ajax->blur($element_id, $actions);

**Update in all demos, you can see these changes

This is alternative replacement wrapper of the clasic:


* Multiple APIs now work on overlays callbacks
for example you may use Cjax in overlays elements

This means that you can assign actions in an overlay before the overlay is loaded, for example an overlay having an ajax form, would require you to assign the form-api to the overlay (like in this example: http://cjax.sourceforge.net/examples/ajax_login.php) , and this was possible in 5.0, however this functionality was not previously tested with with multiple APIs in the overlay, and only could support one API, now it supports multiple in case you wanted to do other ajax operation within the scope of the overlay, now you in 5.1 you can have work with the scope of the overlay with as many APIs as you please, see sample below:


$overlay = $ajax->overlay('resources/html/login.html');

//work within the scope of the overlay (elements in resources/html/login.html)

//type something in field (within the overlay), and it will change the title
$overlay->keyup('field1', $ajax->document('title','|field1|'));

//Example of adding one more operation in the overlay
$overlay->click('some_image', $ajax->call('ajax.php?url/to/controller'));

//submit ajax-form in the overlay
$overlay->click('button1', $ajax->form('ajax.php?ajax_login/handler'));

//assign the overlay to an element so when you click on it, the overlay pops
$ajax->click('#some_link', $overlay);
On 5.0, this was limited to 1 single API. Now you may add as many as you want.

* Minor improvements & minor bugs fixed
* Expanded the number of parameters you can pass from a to f to a to z.
* Fixed "select" bug that chopped off last item in the array list in "select" ajax API.
* Allow to require 'ajax.php' for codeIgnater, when before it had to be 'ajaxfw.php', (the old way still works)
* Validate & Uploader plugins integration
Plugin validate now integrates with plugin uploader.

$ajax->validate('buttonID', 'ajax.php?optional/pre/action', $rules)->uploader(
  'target' => 'directory/where/files/are/uploaded/to',
  'text'=> 'Uploading Files..',
  'url' => 'ajax.php?optional/post/action', //form post after the files are uploaded
  'form_id' => 'form_id',
  'success_message' => 'Files Uploaded Successfully..',
  'suffix' => time()




If you like Cjax be sure to leave a review (and vote) here: http://sourceforge.net/projects/cjax/reviews/


New sample added:

Full fledged ajax calculator, unlike other "calculators" from other frameworks and libraries, this ajax calculator is a complete basic calculator. The sample code is included in the 5.2 samples download package.




Hi Ajaxboy,

I ask if is possible to resolve the following problem:

in an ajax call for autosearch (populating a div) :


well if a form value is blank then the values passed stops to this field,

for example:

this is field values

|search_username| = salv
|search_cognome| = milite
|search_nome| = '' // blank value
|search_group| = 1
|search_stato| = active

in search_utente function of calls controller,
function search_utente($search1='', $field1='', $search2='', $field2='', $search3='', $field3='', $search4='', $field4='', $search5='', $field5='')
echo $search1 ,'-', $field1, '-', $search2 ,'-', $field2, '-' , $search3, '-', $field3, '-' , $search4, '-', $field4, '-', $search5,'-', $field5;

I get salv-username-milite-cognome------

where the |search_group| value (and field_name group_id) and |search_stato| value (and field_name status) are not present (because of the empty |search_nome| value)

What can I do to avoid this?

Thank you


Hello salvomil,

So the issue is that you are passing two slashes together in the url.

Solution #1
If all these fields are in the same form, I'd recommend using $ajax->form() instead of $ajax->call(), this would automatically submit $_POST all the items without passing them through the url.

To get the values in the controller parameters you will need to name them in alphabetic order ( see form example: http://cjax.sourceforge.net/examples/send_form.php)


Solution #2

A possible way around is adding prefixes:


Then you would have to remove the prefix of each value, a little bulky for my taste but could work for you.

Solution #3
Using alternative url type: (see: http://cjax.sourceforge.net/docs/url_styles.php)

This would allow you to do the url in a more flexible way:


If you name them a,b,c,d,e,f etc, they will be passed also as parameters. and so on..

Thank you,
all three way are valid, but he last one is ok for me.

I tried it and now it's ok.

Again, thank you.

FYI, this issue has been fixed in Cjax 5.3 http://ellislab.com/forums/viewthread/229077/

Thanks for your sharing. Its very useful for us. From last month, I was looking for cjax. cjax is an MVC oriented, lightweight (>100kb) ajax framework aimed at PHP applications/sites.

Please How can i install cjax, am new to it, i tried doing it via the readme.html description but nothing, so pls how can i install it

I answered your question in the other thread: http://ellislab.com/forums/viewthread/220312/P70/

Theme © iAndrew 2016 - Forum software by © MyBB