0
我從此代碼中收到'Cookie未定義'錯誤。這段代碼出了什麼問題?請幫助解決它。Cookie未定義錯誤
$('#save-dashboard').on('click', function (e) {
var filtersNew = $("#graph-filters").val();
if (!filtersNew) {
alert('No Filters!');
}
if (cookie.enabled())
{
cookie.defaults.path = '/';
var cookieFilters = cookie.get('cookie-filter-list');
if (cookieFilters) {
cookieFilters = cookieFilters + '#' + filtersNew;
cookie.defaults.expires = 30;
cookie.set('cookie-filter-list', cookieFilters);
cookie.defaults.path = '/';
}
} else {
cookie.defaults.expires = 30;
cookie.set('filter-list', cookieFilters);
cookie.defaults.path = '/';
}
});
我已經設置app.use(express.cookieParser())
編譯器是正確的,什麼是地獄** **被'cookie'? 'cookie.enabled()'是什麼意思? – Ted
你的cookie變量來自哪裏?你有關於它的聲明嗎?如果沒有,那麼這就是爲什麼你會收到錯誤。 – Tom