Welcome Guest, Not a member yet? Register   Sign In
[Solved] CI + XAJAX Global Functions
#12

[eluser]LifeSteala[/eluser]
Sure - here is how I did it.

In MY_Controller put your ajax functions in it - like so:

Code:
function getUserAjax()
{
// Code to get user info via Ajax
}

function getCountries()
{
// Code to get a list of countries
}

These two functions are your Ajax functions. In MY_Controller you also need:

Code:
function loadAjax()
{
$this->xajax->registerFunction(array('getUserAjax',&$this,'getUserAjax'));        
$this->xajax->registerFunction(array('getCountries',&$this,'getCountries'));
}

In your controller you then do this:

Code:
$this->loadAjax();
$data['xajax_js'] = $this->xajax->getJavascript(base_url());
$this->xajax->processRequest();

Viola, you have a global ajax function.

Hope this helps.

Good Luck!


Messages In This Thread
[Solved] CI + XAJAX Global Functions - by El Forum - 08-07-2008, 05:56 PM
[Solved] CI + XAJAX Global Functions - by El Forum - 08-07-2008, 07:05 PM
[Solved] CI + XAJAX Global Functions - by El Forum - 08-07-2008, 07:53 PM
[Solved] CI + XAJAX Global Functions - by El Forum - 08-07-2008, 08:26 PM
[Solved] CI + XAJAX Global Functions - by El Forum - 08-07-2008, 08:37 PM
[Solved] CI + XAJAX Global Functions - by El Forum - 08-07-2008, 09:00 PM
[Solved] CI + XAJAX Global Functions - by El Forum - 08-07-2008, 09:04 PM
[Solved] CI + XAJAX Global Functions - by El Forum - 08-07-2008, 09:13 PM
[Solved] CI + XAJAX Global Functions - by El Forum - 08-07-2008, 09:41 PM
[Solved] CI + XAJAX Global Functions - by El Forum - 08-07-2008, 09:46 PM
[Solved] CI + XAJAX Global Functions - by El Forum - 10-11-2008, 12:30 AM
[Solved] CI + XAJAX Global Functions - by El Forum - 10-12-2008, 02:10 PM
[Solved] CI + XAJAX Global Functions - by El Forum - 10-12-2008, 11:07 PM
[Solved] CI + XAJAX Global Functions - by El Forum - 10-12-2008, 11:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB