var parsed = JSON.parse($.cookie('inavm_inventory'));
inventoryID = parsed['ids'];
inventoryName = parsed['names'];
inventoryCount = parsed['productcount'];
I have a cookie "inavm_inventory" which has 3 array's within it, "ids", "names" and "productcount".
I also have 3 local variables as you can see above.
Currently adding to the cookie all works fine - but when a user loads the page I'm trying to push the cookie arrays into the local variables.
It all works fine without the code above, but when using the code above - it breaks the "array". I've logged the values and they look like arrays, but I'm guessing they may be formatted as strings.
I'm just trying to format them back to arrays so that .push works on my arrays again.
Cookie example data:
{
"ids": "[\"quant[2]\",\"quant[3]\"]",
"names": "[\"2 3 Seater Sofa\",\"0 2 Seater Sofa\"]",
"productcount": "[8,0]"
}