今天用jquery.cookie.min.js存取cookie时,发现取出来的cookie值为undefined
引用文件
<script src="/xxx/static/plugins/jquery.js"></script>
<script src="/xxx/static/plugins/jquery.cookie.min.js"></script>
js
$.cookie('phone', phone, {expires: 7, path: '/xxx'});
console.log("cookie=====" + $.cookie("userPhone"))
控制台打出来的cookie值是undefined,找了下http访问的,要多加个secure: false
$.cookie('phone', phone, {expires: 7, path: '/xxx', secure: false});
console.log("cookie=====" + $.cookie("userPhone"))
就找找jquery.cookie的具体用法吧
在使用jQuery.cookie.min.js进行Cookie操作时遇到问题,发现读取的Cookie值显示为undefined。经检查,发现需在HTTP请求中额外处理。为解决此问题,将深入探究jQuery.cookie.js的正确使用方法。
908

被折叠的 条评论
为什么被折叠?



