jQuery - Cookie set example

0 votes
211 views
added Feb 12, 2020 in jQuery by lcjr First Warrant Officer (11,070 points)
//Cookie configuration
var expAppBanner = new Date();
var exbMin = 3;

expAppBanner.setTime(expAppBanner.getTime() + (exbMin * 60 * 1000));
$abCookie = $.cookie('app-banner');
if ($abCookie == null) {
    $.cookie('app-banner', 'showed', { path: '/', expires: expAppBanner });
    //do here
}
else {
    // cookie at work
}

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...