需要下载jquery的js文件html文件的内容cat1.html<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/><title>getJSON获取数据</title><scripttype="text/javascript"src="jquery-1.8.2.min.js"></script><styletype="text/css">#divframe{border:1pxsolid#999;width:500px;margin:0auto;}.loadTitle{background:#CCC;height:30px;}</style><scripttype="text/javascript">$(function(){$("#btn").click(function(){$.getJSON("1.json",function(data){var$jsontip=$("#jsonTip");varstrHtml="123";//存储数据的变量$jsontip.empty();//清空内容$.each(data,function(infoIndex,info){strHtml+="姓名:"+info["name"]+"<br>";strHtml+="性别:"+info["sex"]+"<br>";strHtml+="邮箱:"+info["email"]+"<br>";strHtml+="<hr>"})$jsontip.html(strHtml);//显示处理后的数据})})})</script></head><body><divid="divframe"><divclass="loadTitle"><inputtype="button"value="获取数据"id="btn"/></div><divid="jsonTip"></div></div></body></html>

json文件的实例内容cat1.json[{"name":"张国立","sex":"男","email":"zhangguoli@123.com"},{"name":"张铁林","sex":"男","email":"zhangtieli@123.com"},{"name":"邓婕","sex":"女","email":"zhenjie@123.com"}]