How do i set my cookie to expire after 30 sec or 1 m ? this is my code :
$.cookie('username', username, { expires: 14 }); // expires after 14 days
For 1 minute, you can use:
var date = new Date();
date.setTime(date.getTime() + (60 * 1000));
$.cookie('username', username, { expires: date }); // expires after 1 minute
For 30 seconds, you can use:
var date = new Date();
date.setTime(date.getTime() + (30 * 1000));
$.cookie('username', username, { expires: date }); // expires after 30 second