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 392633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:10:42+00:00 2026-05-12T16:10:42+00:00

What would be the best approach to this? Because, as I found (and it

  • 0

What would be the best approach to this?

Because, as I found (and it made total sense, only after having tried it :p) that you can’t set a PHP variable on javascripts conditions. (duurrhh)

The only solution I can come up with is to do an AJAX call to a small PHP file that handles the session variables

elm.click(function() {
   $.post("session.php", { "hints":"off" });
   turnOffHints();
}

And then let the session.php deal with setting the new variable.

But it sorta feels like a waste to do a full http request only to set one variable in PHP…

  • 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-12T16:10:43+00:00Added an answer on May 12, 2026 at 4:10 pm

    Javascript (jQuery) is executed on the client-side.

    PHP, and its session mecanism, is executed on the server-side.

    So, to do anything related to a PHP session, you have to go to the server, doing a full HTTP Request — you cannot stay on the client-side.

    Doing an Ajax request is a way of going to the server — works fine 😉

    What you are doing is OK (and necessary, actually), if you want to affect some session data : you don’t have much of a choice, even if it feels like some kind of waste.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am wondering what would be the best approach to store, for let's say
I would like some advice on the best approach to use in the following
How best would I exclude results from #other_section, given a structure like this? <form>
I'm trying to figure out the best way to approach this. I have a
I was wondering what the best approach would be to the following problem. Say
I'm having trouble figuring out the best approach for an certain application. I'm not
Best would be if it performs the highlighting exactly as it is in Visual
What would be best practice to localize your ASP.NET MVC application? I would like
What would be best practice for allowing the user to store data for my
What gems/technology would be best suited for creating an auction style system where a

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.