Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6084827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:34:08+00:00 2026-05-23T11:34:08+00:00

I was going to ask about how to implement sessions in JS,I found few

  • 0

I was going to ask about how to implement sessions in JS,I found few functions that can be used like this example I found :

String exforsys = request.getParameter("test"); 
session.setAttribute("test", exforsys);

And then just use session.getAttribute( exforsys);

But no response, I guess it’s only used in servlets or something.

Anyway, I decided that maybe someone has an alternative way other than just use sessions, what am trying to do is click on a link in one page and depending on which link was pressed I will load different information.

Since its a onclick function, I’m stuck with JS!

So I need to pass this information to the second page, cookies works well cause it can be handled with both PHP and JS easily but some computers deletes cookies and that wouldn’t be nice!

Any suggestions or other ways I can reach what I want but with out using sessions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:34:09+00:00Added an answer on May 23, 2026 at 11:34 am

    Sessions are server variables. Thus cannot be used by JavaScript.

    However, you can retrieve the session variables, through ajax request.

    Script (jQuery)

    //This portion will be triggered once the DOM is loaded and is ready
    $(document).ready(function() {
        $.post("getsession.php",
           { "variable" : "yourneededsessionvariable" }, 
           function(data) {
             //data contains your session data
           }
        );
    });
    

    PHP

    //getsession.php
    <?PHP
    session_start();
    echo $_SESSION[$_POST['variable']];
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hope that this one is not going to be ask-and-answer question... here goes:
I was going to ask a question about preparing a desktop application to support
I was going to ask a question here about whether or not my design
I am going to ask a question that might sound weird. Is there a
I was going to ask this in tigris.org, however they have maintenance in their
Basically I'm going to go a bit broad here and ask a few questions
I have a question that I'm ashamed to ask, but I'm going to have
I want to ask a question about the iPhone application. I am going to
I would like to ask about some advices, how to use Symfony2 SonataAdminBundle. I
Earlier this week I ask a question about filtering out duplicate values in sequence

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.