Cookie Using JSON Format Javascript

Actually, some weeks ago, my senior made me create cookie using JSON format. Ok, keep calm, this is the first time, i create a cookie, i really blank about it 😀 haha the problem is using JSON format too..

I tried creating this cookie in java but the framework that i use, had a problem converting to json formatted cookie.

So, i use javascript instead 😀 and this one is really simple 😀

JSON result format should be, (sort by the newest data)

{"user":[{"name":"sunny","idcard":"88657890"},{"name":"ananti","idcard":"13456778"}]}

Below code is HTML.

Name : <input id="name" type="text" />
ID Card : <input id="idcard" type="text" />
<input onclick="setCookie('name','idcard',1)" type="button" value="Set Cookie" />

Continue reading “Cookie Using JSON Format Javascript”

Cookie Using JSON Format Javascript