Welcome Guest, Not a member yet? Register   Sign In
Ajax Framework (CJAX) for Codeigniter 2.x+
#1

[eluser]Ajaxboy[/eluser]
---------------------------------------------------------------------------
|
| There is a new version here: 5.0+
|
| http://ellislab.com/forums/viewthread/220312/
|
|-------------------------------------------------------------------------

A very basic lightweight but powerful Ajax Framework that complements Codeigniter


New Download Location:
Download here
Quote:Current Version 5.0-RC3.zip
https://sourceforge.net/projects/cjax/fi...deIgnater/

Docs/Wiki
http://codeigniter.com/wiki/Ajax_Framewo...odeIgniter
[/quote]



Download Plugins
https://sourceforge.net/projects/cjax/files/Plugins/
[/quote]



Old Download Location (reference)
Quote:http://code.google.com/p/ajax-framework-...loads/list


This framework separates your normal controllers from your ajax controllers (don't you think it is a mess to have them all in the same place?.

https://sourceforge.net/
#2

[eluser]Ajaxboy[/eluser]
Using Jquery:
Code:
$.get("ajax.php?sample/test/test1/test2/test3", function(response){

  alert(response);
  });

application/response/sample.php
Code:
class Sample extends CI_Controller {

function test($a,$b,$c)
{
  
  echo "$a $b, $c";
  //prints test1 test2, test3
}

}
#3

[eluser]Ajaxboy[/eluser]
New Version released

Download here:

http://sourceforge.net/projects/cjax/files/CodeIgnater/


Now you can use jquery to make ajax request, and make FULL use of the API without the need of any (framework) JavaScript in the fron-end, just include the Js library in the head of the page (cjax/core/js/cjax.min.js). It makes automatic use of complete() ajax function on jquery. It does not require jquery to fully operate, it is just a helper in case you do use jquery.

Go here to view the changelog - http://code.google.com/p/ajax-framework-...NGELOG.txt

#4

[eluser]InsiteFX[/eluser]
And what if I do not want to use query strings?

I use Xajax and I can pass the data anyway I want like CodeIgniters urls...

I have converted Xajax v0.6b to CodeIgniter and also wrote the Xajax new pagination library using CodeIgniters.
#5

[eluser]Ajaxboy[/eluser]
Glad that you were able to create a pagination library, sounds nice.

You can still use query string after the url.

What I am referring to is the "callbacks" that are triggered with the response of the ajax request. Cjax generates xml commands that are passed on the response text and triggers action from the backend. As such:

Code:
$ajax->overlayContent("Show An overlay in the screen!");

You can make ajax requests with much anything, but to be clear, the integration with jquery is that it picks the response automatically without any extra steps, but you don't need jquery, but being the case that it is very popular it was integrated into to remove extra steps and make the framework easier and more friendly to use.

This is what you need to put to process back-end response, using anything else to make request:
Code:
CJAX.process_all(response);

What this means is, - a step closer to create dynamic functionality without writing much code.

Cjax is intended to be a "generic" lightweight ajax framework, with generic utils. Though Specific libraries sound nice.

You can also pass nice url with this framework, such as ajax.php?controller/function/arg1/arg2 etc.

By no means I have tested friendly urls with CI. I have not touched that section in a while, so no guarantees.
#6

[eluser]Ajaxboy[/eluser]
New Release

Download:
Quote:http://sourceforge.net/projects/cjax/files/CodeIgnater/


Changes:

Full support for friendly URLS.

You may access your controllers in any of the following ways:

Code:
ajax.php?controller=test&function=test&a=arg1&b=arg2

ajax.php?test/test/arg1/arg2

ajax.php/test/test/arg1/arg2

ajax/test/test/arg1/arg2

and so on.

to use the last url, you will need to use the included htaccess.txt file and rename it into .htaccess.

Although there is no need, If you want to use a query string outside of the parameters, use:

ajax.php?controller=test&function=test&a=arg1&b=arg2&query_string=anything&query2=something

You should be able to pass any query string within the parameters (arg1/arg2/arg3/arg4, etc. or a,b,c,d,e,f etc)
Eg.

Code:
ajax.php?test/test/query1/something/someID/xyz/query5

access these query strings:

application/response/test.php
Code:
class controller_test extends CI_Controller {
    function test($query1,$query2,$query3,$query4,$query5)
    {
       echo $query1;
       echo "<br />";
       echo $query2;
       echo "<br />"
       echo $query3;
       echo "<br />"
       echo $query4;
       echo "<br />"
       echo $query5;
       echo "<br />"
    }

}

See change log: http://code.google.com/p/ajax-framework-...GELOG4.txt


#7

[eluser]InsiteFX[/eluser]
Thanks Ajaxboy I will check this out this weekend.
#8

[eluser]Ajaxboy[/eluser]
Any time, here is a little bit of documentation:

http://codeigniter.com/wiki/Ajax_Framewo...odeIgniter
#9

[eluser]Ajaxboy[/eluser]
New Version Released
Quote: http://sourceforge.net/projects/cjax/files/CodeIgnater/


Changes from 4.1RC1 TO 4.1RC2

+ Improved the ability to define controllers directory and added 'AJAX_CD'.

* Fixed some minor vital bugs that were introduced while fixing/improving code blocks.

* Minor bug fixes.

* Improved some coding blocks and format.

* Updated Examples to use AJAX_CD

* Fixed a bug when uploading files and ajax security, preventing files from being uploaded.

* Update demos, and added more tips and info

See full ChangeLog: http://code.google.com/p/ajax-framework-...NGELOG.txt


All Demos Updated( this is brand new for CI).

Download Demos
Quote:http://code.google.com/p/ajax-framework-...amples.zip

20+ Demos, the demos are embedded in simple HTML pages, not in CI, you may implement any of these demos in your CI AJAX Framework.

To test the demos, just place the "examples" directory that comes in the zip, into your CI installation, and go to the URL:/examples in your CI Installation.


#10

[eluser]InsiteFX[/eluser]
I looked through the new code.

You need to go through all of your code and replace ereg with preg !




Theme © iAndrew 2016 - Forum software by © MyBB