[jQuery] problem with cookie plugin when trying to store array object in cookie
I don't see this is a problem with cookie plugin in particular but this is
problem with cookie itself.
Suppose this is the array
var arr = [];
arr.push({name:"vj",rollNo:10});
arr.push({name:"kr",rollNo:15});
The size of arr is 2 before storing in cookie
I tried to store this array object in a cookie as $.cookie("cookieName",
arr), and then later when I tried to access the length of array with cookie
as var tempArr= $.cookie("cookieName")--which should give array object named
"arr".
and then I tried to alert length of array as alert(tempArr.length); I was
expecting size of array to be 2 but surprisingly its returning 31. I printed
the value of tempArr like alert("arr="+ tempArr+" len="+tempArr.length).
it prints arr=[object Object],[object Object] len=31.
When you calculate the each character of [object Object],[object Object] it
returns 31.
Can any one of you come up with quick solution of how to store array of
array objects in a cookie.
It'll be greatful.
Regards,
Vijay
--
View this message in context: http://www.nabble.com/problem-with-cookie-plugin-when-trying-to-store-array-object-in-cookie-tf4516799s15494.html#a12883618
Sent from the JQuery mailing list archive at Nabble.com.