日期:2014-05-16  浏览次数:20704 次

jquery请求本地json,貌似没执行?
chat.json:
JScript code
[
 {
 "name":"11",
 "age":"22"
 }
]

json.html:
HTML code
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script src="js/jquery-1.6.2.js"></script>
<script type="text/javascript">
    $().ready(function() {
        $.getJSON('chat.json',function(data){
                alert(data.name);
            });
    });
</script>
</head>

<body>
</body>
</html>


------解决方案--------------------
JScript code
// alert(data.name);
//=====>
 alert(data[0].name);