My code snippet:
function receive(mag)
{
var text = eval(mag);
alert(text);
}
receive('["magnolia,", ["Magnolia (Flower)"], [], [], [], [], [], [[3, 19019, "INV_MAG_39 ", 5]]]');
When I pass the string in the example (shown above), the eval(mag)
doesn't work.
But if I do it directly like this:
function receive(mag)
{
var text = eval('["magnolia,", ["Magnolia (Flower)"], [], [], [], [], [], [[3, 19019, "INV_MAG_39 ", 5]]]');
alert(text);
}
It does work. Does anyone have an idea whats wrong / how can I get it working with passed variable?