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 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

I read that cookie values can be set after HTML content has been sent
hello, how can i set cookies like 'last_visit' if the user have more than
How can i set the Windows Forms webbrowser control to block or allow cookies
How can i read cookie set date? In rails api I can not find
I have a site, e.g. example.com , where users can set their own subdomains
At work we ran up against the problem of setting server-side cookies - a
I have one server but two directories for example: www Directory1 index.php page1.php page2.php
I know that I can set expiration date for a cookie, but can I
there is one think, i can't understand anyway:((( when i try to set cookie(it
A HTTP Cookie consists of a name-value pair and can be set by the

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.