Welcome Guest, Not a member yet? Register   Sign In
XAJAX and CodeIgniter Reactor
#1

[eluser]IgnitedCoder[/eluser]
I'm not a guru at it but I have some experience using XAJX and CI with some success. I've started this topic to help other CI devs get upto speed with it quickly.
#2

[eluser]IgnitedCoder[/eluser]
NOTE this is XAJAX 0.6X beta 1.

So heres how to get XAJAX working on CI without too much of a hassle.

1. Grab the libraries.zip file and unzip it to your application/libraries folder.
2. Grab the xajax_js.zip folder and unzip it to your sites root folder.

You're all set to load xajax... either via autoload or as follows:

Controller Code.
Code:
function index(){
$this->load->library('xajax');
$this->xajax->configure("javascript URI", base_url());
$this->xajax->register(XAJAX_FUNCTION, array('say_hello', &$this, 'say_hello'));
$this->xajax->processRequest();
}

function say_hello(){
$objResponse = new xajaxResponse();
$objResponse->Assign("div_id_in_view", "innerHTML", $this->load->view('_partials/comment/post',$data,true)); //this dynamically loads a form into the div.
//OR
$objResponse->Assign("div_id_in_view", "innerHTML", "Just saying hello from XAJAX.");
return $objResponse;
}

View Code.
In header section of html of course.
Code:
<?=$this->xajax->printJavascript();?>

Hope this helps...
#3

[eluser]IgnitedCoder[/eluser]
Could'nt upload all the files... heres libraries.tgz file for XAJAX.

Brendan
#4

[eluser]CopyJosh[/eluser]
If you're using CSRF, this won't work. Took me awhile to figure out but for for XAJAX and CI 2.0 with CSRF, the following will probably be more helpful:

http://www.gen.newrandom.com/2011/07/21/...-csrf-fix/
#5

[eluser]IgnitedCoder[/eluser]
Excellent catch, please send along your changes to the source files. Quick upload to this post would be most appreciated. Also very well documented, thanks.
#6

[eluser]CopyJosh[/eluser]
The files are attached or you can find them individually (with the zip) here:

http://public.newrandom.com/examples/codeigniter/
#7

[eluser]redcoder[/eluser]
I can't download the file ??
#8

[eluser]CopyJosh[/eluser]
From the forum or http://gen.newrandom.com?
#9

[eluser]redcoder[/eluser]
Thanks summer student.
what about the xajax_js.zip ?
#10

[eluser]InsiteFX[/eluser]
You need to go to Xajax and download the beta 06




Theme © iAndrew 2016 - Forum software by © MyBB