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

[eluser]Jagar[/eluser]
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:

Code:
function index() {
  $this->load->library('xajax/xajax');    
  //$this->xajax->registerFunction("test_function"); does not work in class this way
    $this->xajax->registerFunction(array($this,"test_function"));
  $this->xajax->processRequest();
  $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;
  }


Messages In This Thread
using ajax - by El Forum - 05-04-2009, 10:28 PM
using ajax - by El Forum - 05-04-2009, 10:45 PM
using ajax - by El Forum - 05-05-2009, 04:10 AM
using ajax - by El Forum - 05-05-2009, 06:53 AM
using ajax - by El Forum - 05-05-2009, 07:44 AM
using ajax - by El Forum - 05-05-2009, 08:25 AM
using ajax - by El Forum - 05-05-2009, 08:28 AM
using ajax - by El Forum - 05-09-2009, 11:40 AM
using ajax - by El Forum - 05-09-2009, 02:52 PM
using ajax - by El Forum - 05-10-2009, 02:53 AM
using ajax - by El Forum - 05-10-2009, 09:50 AM
using ajax - by El Forum - 05-10-2009, 11:54 AM
using ajax - by El Forum - 05-10-2009, 12:07 PM
using ajax - by El Forum - 05-10-2009, 12:53 PM
using ajax - by El Forum - 05-10-2009, 01:10 PM
using ajax - by El Forum - 05-12-2009, 12:34 PM
using ajax - by El Forum - 05-12-2009, 12:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB