I am trying to save an array and restore it on another page using Cookies.
This is my code on Page 1:
var films = [];
SetCookie("cart", films);
Values are put into films through button on a cart, it stores values e.g. "Star Wars","Resident Evil".
On alert it is stored: Star Wars, Resident Evil
This is my code on Page 2:
function getMovie2() {
var movie = [];
movie = (GetCookie("cart"));
var r = movie.length;
alert(r);
$("#table1").empty();
for (var i = 0; i < r; i += 1) {
$("#table1").append("<tr><td>" + movie[i] + "</td><td>");
}
}
The lenght that I get from this is for EACH Character and not the number of things in Array.
Where am I going wrong? I am trying to store an Array in a Cookie and then retrive it and save it in an Array.