jQuery ajax getjson demo
来源:互联网 发布:超人电力工程预算软件 编辑:程序博客网 时间:2024/06/05 15:39
<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"><html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>getjson demo</title><script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script><script> function loadData(){ //发出请求 $.getJSON('1.json', function(data){//得到内容 var ret = []; $.each(data, function(i, entry){//遍历返回的数据 var html='<tr>'; html+='<td bgcolor="#FFFFFF">'+entry['dm']+'</td>'; html+='<td bgcolor="#FFFFFF">'+entry['name']+'</td>'; html+='<td bgcolor="#FFFFFF">'+entry['zuixin']+'</td>'; html+='<td bgcolor="#FFFFFF">'+entry['zhangdie']+'</td>'; html+='<td bgcolor="#FFFFFF">'+entry['mairu']+'</td>'; html+='<td bgcolor="#FFFFFF">'+entry['maichu']+'</td>'; html+='<td bgcolor="#FFFFFF">'+entry['zuigao']+'</td>'; html+='<td bgcolor="#FFFFFF">'+entry['zuidi']+'</td>'; html+='<td bgcolor="#FFFFFF">'+entry['zuojie']+'</td>'; html+='<td bgcolor="#FFFFFF">'+entry['zuoshou']+'</td>'; html+='<td bgcolor="#FFFFFF">'+entry['times']+'</td>'; html+='</tr>'; ret.push(html);//存入数组 }); $('#title').html('<table>' + ret.join('') + '</table>');//将数组合并后,写入 #title 中 }); } $(document).ready(function(){//DOMReady时触发 loadData();//先执行一次,将内容显示出来 setInterval(loadData, 1*1000);//然后每隔10秒执行一次,时间请根据需要自己修改 }); </script> </head> <body> <div id="title"></div> </body></html>
json
[{"dm":"CU11","name":"\u65b0\u534e\u94dc1T","zuixin":"43065","zhangdie":"89","mairu":"43099","maichu":"43065","zuigao":"43499","zuidi":"42693","zuojie":"42976","zuoshou":"42978","times":"2014-08-12 17:42:47"},{"dm":"CU5","name":"\u65b0\u534e\u94dc5T","zuixin":"43065","zhangdie":"89","mairu":"43099","maichu":"43065","zuigao":"43499","zuidi":"42693","zuojie":"42976","zuoshou":"42978","times":"2014-08-12 17:42:40"}]
阅读全文
0 0
- jQuery ajax getjson demo
- jQuery ajax - getJSON() 方法
- jquery+ajax+%24.getJson.docx
- jQuery $.ajax() $.get() $.post() $.getJSON()
- jQuery中ajax-$.getJSON,$.getScript
- Ajax / jQuery.getJSON简单示例
- jquery ajax请求的用法($.ajax, $.getJSON)
- 【jQuery】Ajax函数:$.get(),$.post(),$.ajax(),$.getJSON()
- Jquery Ajax GetJson实现跨域调用
- Jquery的$.get $.post $.getJSON $.ajax
- Asp.Net+Jquery.Ajax详解4-$.getJSON
- jQuery ajax - getScript() 方法和getJSON方法
- jQuery AJAX —篇四 $.getJSON()
- jQuery AJAX —篇四 $.getJSON()
- jquery get post ajax getjson区别
- JQuery 异步处理,ajax post get getJSON...
- 深入Jquery-$.ajax 、$.get、$.post、$.getJSON
- jQuery ajax - getScript() 方法和getJSON方法
- go select用法
- vb.net 教程 12-5 webbrowser 与窗体交互3
- poj1986 lca(tarjan算法)
- 写好Hive 程序的五个小结[笔记7]
- zookeeper系列(一)
- jQuery ajax getjson demo
- SAMBA(下)
- 笔记8——Linux系统定时任务
- PHP基础之流程控制
- 前端代码规范
- HDU 6129 Just do it(找规律+杨辉三角)
- socket中recv() send() read() write()区别
- 二分图匹配 --- 最小点覆盖
- jdbc核心之事务