我不明白在解析文件时出了什么问题:
{ "t": -9.30, "p": 728.11, "h": 87.10 }
Javascript 代码:
<script type="text/javascript">
function check() {
$.get("http://....file.json", function(response, status, xhr) {
if (status == "success") {
var json = JSON.parse(response);
$("#temp").html(json.t + "°");
$("#pressure").html(json.p + " mm hg");
}
if (status == "error") {
$("#temp").html("error");
}
});
}
我收到了错误信息:
SyntaxError: JSON Parse error: Unexpected identifier "object"