• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Xajax: Undefined index: query, can't return data to browser!

I have the following code:

function add_guestbook($data)
        $message='<div class="notice">Message added successfully!</div>';
        $message='<div class="error">Adding message failed!</div>';
        $add_guestbook_response = new xajaxResponse();

        $add_guestbook_response->assign("message_div", "innerHTML", $message);
        $add_guestbook_response->assign("name", "value", "");
        $add_guestbook_response->assign("email", "value", "");
        $add_guestbook_response->assign("message", "value", "");

        return $add_guestbook_response;

I've used XAJAX before and didn't encounter any problems. But for a new site i'm running into a problem. I have this code executed by a submit button. It get's the data from a form a puts the data into the database. That works fine. Now I wan't sen't a message back containing a confirmation or error message. And I want to empty the form whitout reloading the page. The last two parts don't work.
I'm seeing the following notice in the error log:
Severity: Notice --&gt; Undefined index: query /usr/home/********/domains/******.**/public_html/website/system/libraries/xajax.php 907

Has it something to de with me using ob_start(); at the first codeignitor index.php file?

Can't find the solution, have searched this forum and XAJAX forum.


I have the same error.

Severity: Notice --&gt; Undefined index: query /home/jgodino/public_html/xxxx/sginfra_system_files/application/libraries/xajax.php 572



I've been having this problem now too.. starting to look for a fix. any solutions?

See the code below, the problem is that the first line will only work for the default controller!
For all other controllers you need to use the second line.
// --------------------------------------------------------------------

* __construct()
* Class    Constuctor PHP 5+
* @access    public
* @return    void
public function __construct()
    // Initialize xajax

// --------------------------------------------------------------------

* _xajax()
* Load, intialize and configure the xajax library.
* @access    private
* @return    void
private function _xajax()

    // this is the problem here in the configure!
    // this line will only work for the default controller!
    $this->xajax->configure("requestURI", base_url());

    // for all other controllers you need to do this!
    $this->xajax->configure("requestURI", site_url('Controller'));

    $this->xajax->configure("javascript URI", base_url().'assets/');

    // Register xajax PHP functions
    $this->xajax->register(XAJAX_FUNCTION, array('method_name', &$this, 'method_name'));

Curiosity of IgnitedCoder.


InsiteFX, that is a good way of distinguishing, but it honestly doesn't matter if you use either one as long as you point to the controller that makes the call, for example, you can also use:

$this->xajax->configure("requestURI", base_url('index.php/controller'));

For some reason mine is working for simple ajax function calls (i.e. change the innerHTML of a div via <a >) but it still gives me the query error

Severity: Notice  --&gt; Undefined index: query C:\Program Files (x86)\EasyPHP-\www\CodeIgniter\application\libraries\xajax\Xajax.php 1010

Thank you InsiteFX now Xajax is working Smile

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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