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

[eluser]aslamdoctor[/eluser]
Can you please post all the steps you followed to make xajax functions global???

It is highly required solution.
#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!
#13

[eluser]aslamdoctor[/eluser]
thanks for that
#14

[eluser]LifeSteala[/eluser]
Most welcome.. Smile




Theme © iAndrew 2016 - Forum software by © MyBB