Hey,
Im at my wits end!
Im trying to get IE to store a string that defines a multi-demensional array as an actual array.
Heres what the array definition would look like:
No problem!
but i have this stored as a string (without the foo = part). So im using eval() to evaluate the code. It's worked in most combinations i've tried in firefox no problems but none in IE. Heres some of what ive tried:
To further complicate things, some of the values in the array sometimes have ' characters in, however i just want to get it working without first then i can probably just add slashes to solve that problem.
Any Help is much apprieciated!
Andy
Im at my wits end!
Im trying to get IE to store a string that defines a multi-demensional array as an actual array.
Heres what the array definition would look like:
Code:
foo = Array( {'key' : 'value', 'key2' : 'value2'},{'key' : 'value', 'key2' : 'value2'}, {'key' : 'value', 'key2' : 'value2'}, {'key' : 'value', 'key2' : 'value2'});
alert(foo[1]["key"]);
but i have this stored as a string (without the foo = part). So im using eval() to evaluate the code. It's worked in most combinations i've tried in firefox no problems but none in IE. Heres some of what ive tried:
Code:
foo = "Array( {'key' : 'value', 'key2' : 'value2'},{'key' : 'value', 'key2' : 'value2'}, {'key' : 'value', 'key2' : 'value2'}, {'key' : 'value', 'key2' : 'value2'});";
foo = "\"Array( {\"key\" : \"value\", \"key2\" : \"value2\"},{\"key\" : \"value\", \"key2\" : \"value2\"}, {\"key\" : \"value\", \"key2\" : \"value2\"}, {\"key\" : \"value\", \"key2\" : \"value2\"});\";";
foo = "\"Array( {'key' : 'value', 'key2' : 'value2'},{'key' : 'value', 'key2' : 'value2'}, {'key' : 'value', 'key2' : 'value2'}, {'key' : 'value', 'key2' : 'value2'});\"";
myarray = eval(foo);
alert(myarray[1]["key"]);
To further complicate things, some of the values in the array sometimes have ' characters in, however i just want to get it working without first then i can probably just add slashes to solve that problem.
Any Help is much apprieciated!
Andy
Comment