• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What do you do for ajax requests?

#11
[eluser]FuzzyJared[/eluser]
I should have mentioned that I was using the newest beta version. I am sure that is what is causing the problems between this forum and xajax. I will just use 2.5 stable release instead.

#12
[eluser]FuzzyJared[/eluser]
http://community.xajaxproject.org/viewtopic.php?id=765

Here is a thread that explains how to get 5 beta release to work. I followed it and was able to get it working

Taken from post by Belarus, Brest

First, directory structure.
I've copy folder "xajax_js" from xajax 0.5 archive into the top-level folder without renaming. All files and subflolders from "xajax_core" i've copy to the application/libraries/ folder and rename xajax.inc.php into xajax.php.
Second, code.
File xajax_init.php is the same as in the CI wiki.
Controller testxajax.php looks like this

Code:
Code: PHP

<?php
Class Testxajax Extends Controller
{

    function Testxajax()
    {
      parent::controller();
    $this->load->library('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('../../');

        $template['content'] = '<div id="SomeElementId"></div>&lt;input type="button" value="test" onclick="xajax_test_function(2);"&gt;';

        $this->load->view('template', $template);
  
    }
  

}
?&gt;


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.