今天用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的具体用法吧