Script47 Posted September 30, 2013 Share Posted September 30, 2013 I've been attempting to store multiple values of data in a single cookie, I know it's possible but don't know where to look or how to do it. Would be really helpful if someone could help! :) Quote Link to comment Share on other sites More sharing options...
dnenb Posted September 30, 2013 Share Posted September 30, 2013 Just add them together in one seperated by a comma or something? What kind of data do you want to use in the cookie? Quote Link to comment Share on other sites More sharing options...
Script47 Posted September 30, 2013 Author Share Posted September 30, 2013 Just add them together in one seperated by a comma or something? What kind of data do you want to use in the cookie? Integers mainly Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted October 1, 2013 Share Posted October 1, 2013 after a quick google search I found this: http://stackoverflow.com/questions/16779635/how-to-set-multiple-values-in-a-single-cookie-using-a-delimiter Judging by the posts the OP was using | as a delimeter and I guess that's not too good to do so I guess you should use something else. I'm not good with js what so ever but maybe its a starting point and I won't give it my stamp of approval either :p Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted October 1, 2013 Share Posted October 1, 2013 you could store your data as JSON and then recover it. Check out what JSON is and then: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify In that way you can store an array or more complex structures without having to care. Quote Link to comment Share on other sites More sharing options...
Dayo Posted October 1, 2013 Share Posted October 1, 2013 I agree with what a_bertrand said, the bonus with JSON is you can read it in PHP as-well so if you are making a application that uses both its very useful Quote Link to comment Share on other sites More sharing options...
dnenb Posted October 1, 2013 Share Posted October 1, 2013 JSON sounds like a good choice!:) Quote Link to comment Share on other sites More sharing options...
advocaite Posted October 9, 2013 Share Posted October 9, 2013 becarefull what you hold in cookies cause cookies can be modified with ease and should never be trusted as a main source of data Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.