How to access $_SESSION in jQuery ?
I'm developing a existing chat using jQuery with PHP. here is the code
function createChatBox(chatboxtitle,minimizeChatBox) {
if ($("#chatbox_"+chatboxtitle).length > 0) {
if ($("#chatbox_"+chatboxtitle).css('display') == 'none') {
$("#chatbox_"+chatboxtitle).css('display','block');
restructureChatBoxes();
}
$("#chatbox_"+chatboxtitle+" .chatboxtextarea").focus();
return;
}
$(" <div />" ).attr("id","chatbox_"+chatboxtitle)
.addClass("chatbox")
.html('<div class="chatboxhead"><div class="chatboxtitle"><a href="javascript:void(0)" onclick="javascript:toggleChatBoxGrowth(\''+chatboxtitle+'\')">'+chatboxtitle+'</a></div><div class="chatboxoptions"><a href="javascript:void(0)" onclick="javascript:toggleChatBoxGrowth(\''+chatboxtitle+'\')">-</a> <a href="javascript:void(0)" onclick="javascript:closeChatBox(\''+chatboxtitle+'\')">X</a></div><br clear="all"/></div><div class="chatboxcontent"></div><div class="chatboxinput"><textarea class="chatboxtextarea" onkeydown="javascript:return checkChatBoxInputKey(event,this,\''+chatboxtitle+'\');"></textarea></div>')
.appendTo($( "body" ));
$("#chatbox_"+chatboxtitle).css('bottom', '0px');
);
**The perameter **+chatboxtitle+** will display the username which is passed to this function. now i want to display the fistname of the user using session in this following line**
` .html('<div class="chatboxhead"><div class="chatboxtitle"><a href="javascript:void(0)" onclick="javascript:toggleChatBoxGrowth(\''+chatboxtitle+'\')">'+chatboxtitle+'</a></div><div class="chatboxoptions"><a href="javascript:void(0)" onclick="javascript:toggleChatBoxGrowth(\''+chatboxtitle+'\')">-</a> <a href="javascript:void(0)" onclick="javascript:closeChatBox(\''+chatboxtitle+'\')">X</a></div><br clear="all"/></div><div class="chatboxcontent"></div><div class="chatboxinput"><textarea class="chatboxtextarea" onkeydown="javascript:return checkChatBoxInputKey(event,this,\''+chatboxtitle+'\');"></textarea></div>')`
I want to use the session variable $_SESSION['user']; over there ? is it possible ? or we can call another perameter ? please help me i'm stuck with this..