I have a cookie set up which has data stored in the following format:
{"g":"776","f":"88876","hit":"true","TESTVALUE":"this is the value i want to capture"}
I want to capture "TESTVALUE" in its own variable.
I am using this script to actually capture the cookie data (where the cookie is called "chocolateChip":
var getCookie = function (name) {
var re = new RegExp(name + "=([^;]+)");
var value = re.exec(document.cookie);
return (value != null) ? unescape(value[1]) : null;
} // code indentation
var cookie = getCookie(chocolateChip);
Im then using the following script to pass the "testvalue" string to its own variable:
var test = cookie.TESTVALUE;
However this does not seem to work.