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

  • Home
  • SEARCH
  • 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 186889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:43:35+00:00 2026-05-11T15:43:35+00:00

How can I set cookies in PHP server-side with Ajax and read cookies in

  • 0

How can I set cookies in PHP server-side with Ajax and read cookies in the real-time with JavaScript?

Example: After pressed ok button, the client-side will call Ajax and Ajax will call to PHP server-side to collect data. It will also assign a value into cookies in PHP server-side while it’s getting the data. At the sametime, I want to read the assigned value cookies with another function in real-time(the function will call from the Ajax when it starts calling to PHP server) and display the cookie’s value on the client-side.

I tried this many time, but seem like the function can only get the updated cookie’s value after the Ajax process is completed.

  • 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. 2026-05-11T15:43:36+00:00Added an answer on May 11, 2026 at 3:43 pm

    How would you be able to read a cookie on the client before it has arrived there?

    1. you make an (ajax, or otherwise) request to the server
    2. the server assembles a response, adding a cookie to it
    3. the client receives the response
    4. after the response is there, it can examine the cookie value

    To me your question sounds like you try to read the cookie right in step 1. This won’t be possible.

    If that’s not what you are trying to do, then your question needs some re-wording. 🙂

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

Sidebar

Related Questions

How can I set the cookies in my PHP apps as HttpOnly cookies ?
I can set the PHP include path in the php.ini : include_path = /path/to/site/includes/
I can set the minimum version required (for example XP SP3) in Inno-Setup by
I have a site, e.g. example.com , where users can set their own subdomains
Is there any standard means in PHP to read the Set-Cookie instructions in an
At work we ran up against the problem of setting server-side cookies - a
If i set a cookie in PHP with the setcookie() function, can i access
I can set data in JTable constructor, and then user can change this data
How can I set the flag FILE_FLAG_BACKUP_SEMANTICS for an fstream object? You can set
In Eclipse I can set all kinds of preferences for coding style. I'd like

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.