But YUI Loader does not use cookies so that means the request that the YUI loader makes will have a new session.
To resolve this I sent the session ID as http://thewebsite.com/theuri?PHPSESSID=
well this doesn't work either. This seems to be because $_COOKIE variables take precedence over $_GET variables in the global scope or maybe $_GET['PHPSESSID'] is not supported at all now. So this is what i needed to do:
if ($_GET['PHPSESSID']) {The above code should be added anywhere before you use session_start() function. It would be ok to include it in the start of the script.
$_COOKIE['PHPSESSID'] = $_GET['PHPSESSID'];
}