I'm trying to set multiple cookies in document.cookie, but unfortunately only one is getting added.
I know there are multiple examples present on the 'Net for setting up these kind of cookies,and I followed one of them. But still I'm unable to set that out. I followed this link to set my cookie.
My Code:
function setCookie(start_time,end_session_time,total_time,flag,count){
var cookie_string = "start_time="+start_time;;
if(end_session_time) {
cookie_string +="; end_session_time="+end_session_time;
}
if(total_time){
cookie_string +="; total_time="+total_time;
}
if(flag){
cookie_string +="; flag="+flag;
}
if(count){
cookie_string +="; count="+count;
}
document.cookie =cookie_string ;
console.log(cookie_string);
console.log("document.cookie ="+ document.cookie);
}
The Output:
cookie_string :: start_time=1369926508266; flag=1; count=1
document.cookie =start_time=1369926508266;