Set a Cookie using Jquery

56
Views
1
Answers

How to set a cookie using JQuery and to read the cookie contents using Jquery?

edit | flag
William Patrick
Asked on: Jun 16, 2011 at 5:16AM

1 Answers

4
7
4

Use this simple jQuery Plugin for cookie
Using this Plugin try this..

Set a cookie

$
.cookie("Cookiename", "content"); // Sample 1
$
.cookie("Cookiename", "content", { expires: 7 }); // Sample 2
$
.cookie("Cookiename", "content", { path: '/admin', expires: 7 }); // Sample 3

Get a cookie

alert
( $.cookie("Cookiename") );

Delete the cookie

$
.cookie("Cookiename", null);
edit | flag
Gokul A
Answered on: Jun 16, 2011 at 7:23PM

Post your Answer

Search

Welcome to Ask Amoeba!
This is 100% free and interactive site for sharing professional Questions and Answers, Opensource projects, Interview questions.
Learners, beginners, Experts stop and share your knowledge and ideas!

Browse Categories

Browse Tags