I have a Joomla 3 site, and under that site but not within the Joomla framework, I'm doing all of my coding. Most of the functionality I'm providing with jQuery AJAX calls. In the PHP scripts used, I'm loading the Joomla framework which is OK but... loading the session is another matter!

I've done heaps of research, and the closest I get is that I could do it if I used the Joomla AJAX calling mechanism. I've been trying to avoid this, mainly because I've never peeked under the hood, and its a whole new "thing" to learn. It also binds my code forever to Joomla.

I'm loading the framework like this:

$joomlaBase = dirname(dirname(dirname(__FILE__)));
if (! defined('_JEXEC')) {
    define( '_JEXEC', 1 );
    define('JPATH_BASE', $joomlaBase);
    define( 'DS', DIRECTORY_SEPARATOR );
    require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
    require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

    $mainframe =& JFactory::getApplication('administrator');

But how to load the session?

  • 1
    Can you please show the current code you'r using to try and call the session using Ajax from the external script?
    – Lodder
    Jul 25, 2014 at 7:02

1 Answer 1


To load the session you need to get it from JFactory.

$session = JFactory::getSession();

Read more on How to access session variables set by an external script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.