Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   Не работаетJquery cookie (https://javascript.ru/forum/jquery/48662-ne-rabotaetjquery-cookie.html)

wollk 11.07.2014 17:41

Не работаетJquery cookie
 
Здравствуйте, ошибка с jquery cookie
Хромовский отладчик указывает на 44 строчку
http://shop-dudishev.ru/templates/sh...js/v_window.js
На локалке, отдельно от джумлы, все работало. Но давай интегрировать в сайт, оно начало ругаться "Uncaught TypeError: undefined is not a function"

wollk 11.07.2014 20:46

Решено
Вместо плагина использовал эти две функции:

function setcookie(name, value, expires, path, domain, secure) {
    expires instanceof Date ? expires = expires.toGMTString() : typeof(expires) == 'number' && (expires = (new Date(+(new Date) + expires * 1e3)).toGMTString());
    var r = [name + "=" + escape(value)], s, i;
    for(i in s = {expires: expires, path: path, domain: domain}){
        s[i] && r.push(i + "=" + s[i]);
    }
    return secure && r.push("secure"), document.cookie = r.join(";"), true;
}
function getcookie(name) {
    var matches = document.cookie.match(new RegExp("(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"));
    return matches ? decodeURIComponent(matches[1]) : undefined;
}


Часовой пояс GMT +3, время: 16:36.