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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:22:01+00:00 2026-05-25T22:22:01+00:00

I am using jQuery to access/set the cookies. I have planted a cookie named

  • 0

I am using jQuery to access/set the cookies. I have planted a cookie named CookieNo1 at path /.

I planted this using the url localhost:8080/audi.

The cookie value is stored, which I checked manually on the firefox cookies. Now when I try to access the same cookie, using the url localhost:8080/audi/products using $.cookie('CookieNo1');

This doesn’t seem to retrieve the value of the cookie. It returns a null value. However when I try to write the cookie using the same localhost:8080/audi/products url, it overwrites the previous cookie value. Please help me with this issue.

All I need is $.cookie('CookieNo1') to return the previous cookie value instead of null.
Thanks in advance

  • 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-25T22:22:02+00:00Added an answer on May 25, 2026 at 10:22 pm

    You have to set the expiry date. Otherwise, the cookie is removed at the end of the session. In JQuery: $("CookieNo1", "value", {expires: 7}) (this cookie stays for 7 days).

    In JavaScript:

    document.cookie = "CookieNo1=value; max-age=604800";
    

    max-age sets the maximum lifetime of a cookie, in seconds.

    EDIT

    Quote from comments:

    @RobW I added the cookie using jquery on the page
    http://localhost:8080/audi with the code $.cookie("asdftraffic",
    valueToSet, { expires: 30, path: '/', secure: true });
    I try to
    retrieve the cookie from the url http://localhost:8080/audi/products
    using '$.cookie('asdftraffic');' which returns null.

    Your issue is caused by secure: true. This attribute requires the cookie to be transmitted over a secure connection (https). Remove the secure: true flag if you’re not using an encrypted connection.

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

Sidebar

Related Questions

I'm using the jquery-cookie module to set/get cookies from jquery. When I set a
I'm using jQuery, and I already have a table set up with a specific
I'm using this jQuery plugin: http://www.xarg.org/project/jquery-webcam-plugin/ When I run this code on localhost ,
How would you access the cache from a jQuery ajax call? I'm using jquery
Using jQuery , how can I dynamically set the size attribute of a select
Using jQuery, how would you find elements which have a particular style (eg: float:
using jquery v1.3.2 and jQuery UI 1.7.1 I have 1 tab control with 3
In my JavaScript (using jQuery) there are a whole set of PHP variables to
We're building a set of external web services to be consumed client-side (using jquery/AJAX)
I am using the jQuery validation plugin on my form. I set the basic

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.