Welcome Guest, Not a member yet? Register   Sign In
how to configure XAJAX 0.5 with codeigniter 1.6.1
#6

[eluser]aroman[/eluser]
Hello Amit,
Ive try to use your code above on my pc and it works well.. i think you have missed something in your xajax setup..
And how would you call the test_function() ?
I assumed to call the test_function is during onclick event of the button..
See my code below,,same as yours but jst a little tweak..
Code:
<?php

class testajax extends Controller
{
    var $error = array( ) ;
    function testajax( )
    {
        parent::controller();
        $this->load->library('xajax');
        ini_set('display_errors',1);
        error_reporting(2039);
         // if (!$this->session->userdata("admin"))// i comment this bec, i dont have an admin side :)
         // {
            // redirect("admin/admin/login");
         // }
        $this->xajax->registerFunction(array('test_function',&$this,'test_function'));
        $this->xajax->processRequest();
    }
    
    function index()
        {
        // my xajax directory path
        $template['xajax_js'] = $this->xajax->getjavascript( base_url( ) . "js/xajax/" ) ;
        //$template['xajax_js'] = $this->xajax->getJavascript(base_url()); // before
        //$template['xajax_js'] = $this->xajax->getJavascript('../../');
        $template['content'] = '<div id="SomeElementId"></div>&lt;input type="button" value="test"  onclick="xajax_test_function(1)" &gt;';
        $this->load->view('admin/template/index', $template);
    }    
    
    function test_function($number)
        {
        $objResponse = new xajaxResponse();
        $objResponse->Assign("SomeElementId","innerHTML", "Xajax is working. Lets add: ".($number+3));
        return $objResponse;
        }    
}
I run these code above and the xajax response works well printed "Xajax is working. Lets add: 4"

-aroman


Messages In This Thread
how to configure XAJAX 0.5 with codeigniter 1.6.1 - by El Forum - 10-02-2008, 05:31 AM
how to configure XAJAX 0.5 with codeigniter 1.6.1 - by El Forum - 10-06-2008, 01:17 AM
how to configure XAJAX 0.5 with codeigniter 1.6.1 - by El Forum - 10-06-2008, 01:54 AM
how to configure XAJAX 0.5 with codeigniter 1.6.1 - by El Forum - 10-06-2008, 03:34 AM
how to configure XAJAX 0.5 with codeigniter 1.6.1 - by El Forum - 10-06-2008, 09:47 PM
how to configure XAJAX 0.5 with codeigniter 1.6.1 - by El Forum - 10-06-2008, 11:43 PM
how to configure XAJAX 0.5 with codeigniter 1.6.1 - by El Forum - 10-08-2008, 06:20 AM
how to configure XAJAX 0.5 with codeigniter 1.6.1 - by El Forum - 11-29-2008, 12:27 PM
how to configure XAJAX 0.5 with codeigniter 1.6.1 - by El Forum - 12-29-2008, 04:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB