CodeIgniter Forums

Full Version: Error: the xajax Javascript component could not be included
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]lsalsich[/eluser]
Hi all,

Man, I have tested this problem in every way and with every browser and configuration I can think of - and no luck. I could really use some guidance on this if possible. Any help would be very much appreciated.

My problem is with including the xajax_core.js file in my application. I'm working in a fairly complex CodeIgniter framework, but in order to try to isolate this problem I created a simple test page and am still getting:

Code:
Error: the xajax Javascript component could not be included. Perhaps the URL is incorrect?
URL: res/xajax_js/xajax_core.js

This happens if I set the $xajax->configure('javascript URI', 'res/') variable to the absolute path, the relative path, the http path, etc. I've checked permissions, moved the folder and even tested that I could open the file in a browser. No luck.

I'm running Apache 2.2.15 and PHP 5.3.3 in case that might matter. Also using CI 2.1.2 and xajax 0.6

Here is my test page (taken from another post in this forum which seemed to deal with the same issue):

Code:
<?php
/**
* 2012-01-19 Ed
* Simple xajax demo page
*
*/

include 'system/libraries/xajax/xajax_core/xajax.php';
$xajax = new xajax();
$xajax->configure('javascript URI', 'res/');

function favoris($user,$fav,$add)
{
    //let's say there's a sql request here. OK
    if($add) //if we add
    {
        $text='Added to your favorites.';
    }
    else
    {
        $text='Removed from your favorites.';
    }    
    
    $objResponse = new xajaxResponse();
    $objResponse->assign('favoris2', 'innerHTML', $text); //So we put $text in <div id="favoris"></div> right?
  
    return $objResponse;
}

$xajax->register(XAJAX_FUNCTION,'favoris');
$xajax->processRequest();
$xajaxjs = $xajax->getJavascript(); //Loads the js into the variable
?&gt;

<!DOCTYPE html>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Xajax Sample&lt;/title&gt;
&lt;?php echo $xajaxjs; ?&gt;
&lt;/head&gt;
&lt;body&gt;
<div id="favoris">
<button>Add Favorite</button>
<button>Remove Favorite</button>
</div>
<div id="favoris2"></div>
&lt;/body&gt;
&lt;/html&gt;

The script does find the file 'xajax.php' but then fails to located the xajax_js folder.

Please help!

Luke