CodeIgniter Forums

Full Version: How integrate XAJAX in CI ??
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Can someone help with integrating xajax into CI ?
I found article in wiki page about that but it seems to be deprecated, because it is using init/ folder that is deprecated in CI latest versions.

So how shoul the library xajax look like?? Smile

El Forum

I think you can just rename the into xajax.php and load it with:

and move on with the example controller...

El Forum

Most of the wiki articles mentioning the use of an init file (stored in a application/init/ directory) are left over from the CI 1.3.x series. The init file was used to initialize a library in those versions and CI handles this internally in newer versions. In most cases, you can rename the library file to meet the guidelines for library creation mentioned in the user guide and ignore all mention of the init file.

The absense of the init file creates a problem for more complex libraries with their own directory structures such as ADODB. There is a workaround solution posted on the wiki for handling ADODB.

El Forum

Ok, library loads, but the example not working Sad
What I do wrong? Here is the code:

Class Testajax Extends Controller
    function Testajax()
    function test_function($number)
        $objResponse = new xajaxResponse();
        $objResponse->addAssign(\"SomeElementId\",\"innerHTML\", \"Xajax is working. Lets add: \".($number+3));
        return $objResponse->getXML();
    function index()
        $template[\'content\'] = \'<div id=\"SomeElementId\"></div>
                                &lt;input type=\"button\" value=\"test\" onclick=\"xajax_test_function(2);\"&gt;\';

        $this->load->view(\'template\', $template);

The view file is very simple with a static link to xajax.js and it only echos $content variable.

Debug message \"xajax_test_function is not defined\".
You can see it in action here:

El Forum

I got example working by turning off error_reporting(E_ALL); in CI index.php
I needed to do this because there was a PHP error before returned XML:
severity: notice
undefined variable: sResponse
file: libraries/xajax.php

how can i fix this and turn on error_reporting again ?

El Forum

hm, call the function that produces the error by hand and see what´s wrong...

El Forum

[quote author=\"PoWah\" date=\"1182519545\"]how can i fix this and turn on error_reporting again ?[/quote]
There is a small error in Xajax. See thread . I tried it out and it definitely works.
But maybe you have found this thread already.