javascriptphpcodeigniterxajax

xajax Javascript component could not be included


I am Facing the following error while using ajax in codeigniter. I have successfully implemented xajax at client side, it it gives the error on admin side. the admin and client controller are at controllers directory.

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

please specify the answer.


Solution

  • I'm assuming that you have a recent version of the Apache2 web server installed, and are not using some other web server. I had exactly this problem and here are my suggestions as they relate to Apache2.

    Make sure that you have a proper alias installed for the xajax files in the Apache2 web server. You should have a .conf file in mods-available, symlinked into mods-enabled, with something very similar to the following:

    <IfModule alias_module>
        Alias /xajax/ /var/lib/php5/xajax/
        Alias /xajax_js/ /var/lib/php5/xajax/xajax_js/
    
        <Directory "/var/lib/php5/xajax">
            Require all granted
            Order deny,allow
            Allow from all
        </Directory>
    </IfModule>
    

    Substitute the appropriate path to your xajax installation in the above.

    In particular, if you are using Apache 2.4, note that the "Require all granted" directive is now required instead of the "Order" and "Allow" directives which accomplished the same thing in Apache 2.2.