Welcome Guest, Not a member yet? Register   Sign In
using ajax

That is wrong, I don't know if you can have a function inside a function, but change it to following and it should work:

function index() {
  //$this->xajax->registerFunction("test_function"); does not work in class this way
  $template['xajax_js'] = $this->xajax->getjavascript('../../');
  $template['content'] = '<div id="SomeElementId"></div>&lt;input type="button" value="test"&gt;';
  $this->load->view('template', $template);

  function test_function($number) {
    $objResponse = new xajaxResponse();
    $objResponse->assign("hello","value", "Xajax is working. Lets add: ".($number+3));
    return $objResponse;

but doesn't help either, still same error...

This is how mine is:


class Test extends Controller {
    function Test(){
    function index(){
        $data['xajax_script'] = $this->xajax->getJavascript("/scripts");
    function test_xajax(){
        $objR = new xajaxResponse();
        $objR->assign('feedback','innerHTML','Hello from xajax');
        return $objR;

Please let me know if that works, the only reason you are getting that redeclared is because you may have it defined somewhere else, make sure you haven't done any includes anywhere in your controller. The only way you will get it to load is through $this->load->library('xajax/xajax');

Thank you for your help!
I will try more during next week, if it won't work, I will install a fresh CI-setup and try again. I will post here my results.
Did you also rename xajax.inc.php into xajax.php?

Yes, I renamed from xajax.inc.php to xajax.php

Uh... I hardly dare to tell: I named my controller 'xajax', that's why! Sad ... well, at least I can now finally start and learn with it Wink

thx for your support!

no wonder it was throwing you that error, glad you got it working!

Theme © iAndrew 2016 - Forum software by © MyBB