I've learned (the hard way) that I need to add parentheses around JSON data, like this:
stuff = eval('(' + data_from_the_wire + ')');
// where data_from_the_wire was, for example {"text": "hello"}
(In Firefox 3, at least).
What's the reason behind this? I hate writing code without understanding what′s behind the hood.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…