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

  1. is use cookie?
  2. how save multiple ids?
  3. how retrieve ids saved/stored in cookie?
  4. do need append existing cookie?

this code give me cookies,i need store ids saved in cookie.

print_r($_cookie); 


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -