javascript - How to make records favorites -
i have list of stores on website.i want users make stores favorite.i not asking them login & not saving in database.
i want save store ids in cookie year. have code.
function setcookie(cname, cvalue, exdays) { var d = new date(); d.settime(d.gettime() + (exdays*24*60*60*1000)); var expires = "expires="+d.togmtstring(); document.cookie = cname + "=" + cvalue + "; " + expires; } function getcookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i<ca.length; i++) { var c = ca[i].trim(); if (c.indexof(name) == 0) return c.substring(name.length,c.length); } return ""; }
i want save each store id , retrieve them.my questions are
- is use cookie?
- how save multiple ids?
- how retrieve ids saved/stored in cookie?
- do need append existing cookie?
this code give me cookies,i need store ids saved in cookie.
print_r($_cookie);
Comments
Post a Comment