Link to home
Start Free TrialLog in
Avatar of glepiza
glepiza

asked on

jquery cookies

Hello Experts,

I would really appreciate if someone can please help me to solve the following issue.

I am creating a on/off button using jquery. When the user clicks ON, the page should refresh and set the cookie and the cookie should stay there until the user closes the browser windows. I am using jquery.cookies.js library.

Can someone please guide me on this? I've been checking a bunch of tutorials and so far my script only sets the cookie (when I refresh the page manually), but I don't see it getting deleted and the page does not refresh automatically. Someone told me to use https request, and well... no idea how to do that....

Any kind of guidance would be greatly appreciate it

Thanks in advance,

winter

PS: this is my script:
    var active = 'active';
    $('#offState a').live('click', function (e) {
        e.preventDefault();
        $.cookie(active, "activemodal", { expires: 7 });

    });
    $('#onState a').live('click', function (e) {
        e.preventDefault();

        $.cookie(active, null);

    });
ASKER CERTIFIED SOLUTION
Avatar of Proculopsis
Proculopsis

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of glepiza
glepiza

ASKER

Thanks! it worked!