jquery - Cookie disappears on page refresh -


i'm using jquery.cookie set cookies, if refresh page or open new page,sometimes, cookie lost. why happening?

here code:

jquery.cookie('sid', 'sessionid', {expires: 30, path: '/', domain: 'xici.net'}); 

discussion: expires: 30 means 30 days, set jquery.cookie library scurse code.

add 30 min value current time specify exipre cookie in 30 minutes in future.

var date = new date(); date.settime(date.gettime() + (30 * 60 * 60 * 1000)); var mycookievalue = $.cookie('mycookie'); jquery.cookie('mycookie', null); jquery.cookie('sid', 'sessionid', {expires: date, path: '/', domain: 'xici.net'}); 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -