[eluser]FabD[/eluser]
Hi all,
I try to use xajax with CI and I hac followed this wiki
Xajax Perfect Setup
But nothing happens ...
Here is my controller
Code:
<?php
class Testxajax extends Controller
{
function Testxajax()
{
parent::controller();
$this->load->library('xajax_core/xajax');
$this->xajax->registerFunction(array('test_function',&$this,'test_function'));
$this->xajax->processRequest();
}
function test_function($number)
{
$objResponse = new xajaxResponse();
$objResponse->Assign("SomeElementId","innerHTML", "Xajax is working. Lets add: ".($number+3));
return $objResponse;
}
function index()
{
$template['xajax_js'] = $this->xajax->getJavascript(base_url().'js/');
$template['content'] = '<div id="SomeElementId"></div><input type="button" value="test">';
$this->load->view('vtestxajax', $template);
}
}
?>
Here is my view :
Code:
<html>
<head>
<title>Xajax 0.5 test</title>
<?php echo $xajax_js?>
</head>
<body>
<h1><?php echo $content?></h1>
</body>
</html>
Here's my html result
Code:
<html>
<head>
<title>Xajax 0.5 test</title>
[removed]
/* <![CDATA[ */
try { if (undefined == xajax.config) xajax.config = {}; } catch (e) { xajax = {}; xajax.config = {}; };
xajax.config.requestURI = "http://belt133374/gerico/index.php?/testxajax";
xajax.config.statusMessages = false;
xajax.config.waitCursor = true;
xajax.config.version = "xajax 0.5";
xajax.config.legacy = false;
xajax.config.defaultMode = "asynchronous";
xajax.config.defaultMethod = "POST";
/* ]]> */
[removed]
[removed][removed]
[removed]
/* <![CDATA[ */
window.setTimeout(
function() {
var scriptExists = false;
try { if (xajax.isLoaded) scriptExists = true; }
catch (e) {}
if (!scriptExists) {
alert("Error: the xajax Javascript component could not be included. Perhaps the URL is incorrect?\nURL: http://belt133374/gerico/js/xajax_js/xajax_core.js");
}
}, 2000);
/* ]]> */
[removed]
[removed]
/* <![CDATA[ */
xajax_test_function = function() { return xajax.request( { xjxfun: 'test_function' }, { parameters: arguments } ); };
/* ]]> */
[removed]
</head>
<body>
<h1><div id="SomeElementId"></div><input type="button" value="test"></h1>
</body>
</html>
If somebody can show me the light ...
Thanks
Fab