The problem of incorrect values occurred when using JQuery to operate cookies:
It turns out that cookies have four different attributes:
Name, content, domain, path
$.cookie('the_cookie'); // Read cookie
$.cookie('the_cookie', 'the_value'); // Store cookie
$.cookie('the_cookie', 'the_value', { expires: 7 }); // Store a cookie with a 7-day expiry date
$.cookie('the_cookie ', '', { expires: -1 }); // Delete cookie
Use:
$.cookie("currentMenuID", menuID); The domain and path are not specified.
All different cookies will be generated when the domain and path are different.
$.cookie("currentMenuID"); There will be problems when taking the value.
So:
$.cookie("currentMenuID", "menuID", { path: "/"});
overwrite. The same cookieID in the same domain corresponds to a value.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn