I'm running on localhost on XAMPP. I am able to set the cookie, and see the result turn up in my Firefox as well as Chrome browser cookie management page. But whenever I close the browser, the cookie data is wiped clean even when the expiry date is set a month in advance. Below is my code:
$('#gen').on('click', function() {
var data = "John";
date = new Date();
date.setMonth(date.getMonth()+1);
document.cookie="name="+data;
document.cookie="expires="+date;
});
Any comments would be much appreciated. Thank you for reading.