Jquery

How to set cookies and get cookies using jquery

Pinterest LinkedIn Tumblr

You can check this links

https://github.com/carhartl/jquery-cookie

Use this js code in your website

<script type="text/javascript"
 src="//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js">

So you can read cookie like this:

var value = $.cookie("obligations");

Also, you can write cookie:

$.cookie('obligations', 'new_value');
$.cookie('obligations', 'new_value', { expires: 14, path: '/' });

Delete cookie:

$.removeCookie('obligations');

Write A Comment

Faster PHP Cloud Hosting