Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 442
Registered: ‎08-02-2010
My Device: Z10
My Carrier: Telus
Accepted Solution

How do I access $_SESSION vars in jquery mobile

Hello everyone. I'm creating an app with jquery mobile. I created.a login format that uses getJSON() to validate the login with photos. If successful the login.html redirects to the loggedin.html.

 

I stored the username in. A session various in the photo. How can I get the username after the user is logged in?

Developer
Posts: 434
Registered: ‎07-23-2012
My Device: Blackberry 10
My Carrier: Orange

Re: How do I access $_SESSION vars in jquery mobile

not sure but this link might help you

 

http://stackoverflow.com/questions/607673/setting-a-php-sessionvar-using-jquery

 

Thanks
-------------------------------------------------------------------------------------
Press the Accept as solution Button when u got the Solution
Press Kudo to say thank to developer.
-------------------------------------------------------------------------------------.
Developer
Developer
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: How do I access $_SESSION vars in jquery mobile


RapsFan wrote:

Hello everyone. I'm creating an app with jquery mobile. I created.a login format that uses getJSON() to validate the login with photos. If successful the login.html redirects to the loggedin.html.

 

I stored the username in. A session various in the photo. How can I get the username after the user is logged in?


If you redirect to a static page I think it isn't possible to get the $_SESSION information in the client. You could use a XHR-request to a script on your server responding with some JSON based informations containing the $_SESSION information (username) you want to get.

 

If you are redirecting to a dynamic page you could write the $_SESSION information directly to the dynamic page content header using something like this:

<script type="text/javascript">
	var username = "<?PHP echo $_SESSION['username']; ?>";
</script>

 Perhaps this is what you are looking for.


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.