我尝试解析JSON字符串,但解析后的值未定义。这是jsfiddle
<input type="submit" onclick=testJSON() value="Test"/>
<div id = "result">Test </div>
<script>
function testJSON() {
var jsonString = '{"param1":"123","param2":"XXX78","param3":"11378"}';
document.getElementById("result").innerHTML = (JSON.parse(jsonString)).param2;
}
</script>