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.