日期:2014-05-16 浏览次数:20396 次
服务器返回的数据格式:
dynamicData({ "items": [ { "title": "新闻1", "publishTime": "2012-03-15 10:53:30", "linkUrl": "/zcms/Docs/news/5/html/5521186/20120315105319504.shtml" }, { "title": "新闻2", "publishTime": "2012-03-15 10:53:30", "linkUrl": "/zcms/Docs/news/5/html/5521186/20120315105305222.shtml" }, { "title": "新闻3", "publishTime": "2012-03-15 09:47:28", "linkUrl": "/zcms/Docs/news/5/html/5521186/20120315094709368.shtml" } ] })
?
页面的调用方法为:
<script type="text/javascript"> function dynamicData(data){ $.each(data.items, function(i, v){ alert(v.title+" "+v.linkUrl+" "+v.publishTime); }); } </script> <script type="text/javascript" src="请求服务器返回数据的地址"></script>