jquery+ajax实现排名小应用
2010-12-31 15:47
344 查看
在action中读取数据库数据并做好排序,
在struts.xml中
<package name="example" extends="json-default">
<action name="test"
class="com.test">
<result type="json"></result>
</action>
</package>
使用json插件jar包jsonplugin-0.33.jar
js文件:
<script>
$(function(){
$.getJSON(‘action的url地址’,function(data){
$.each(data,function(entryIndex,entry){
for(var i=0;i<$(entry).size();i++){
var html="<tr height='26'>";
html+="<td width='52' align='center' valign='middle'>"+(i+1)+'</td>';
html+="<td width='100' align='center' valign='middle'>"+(entry[i].userName.substring(0,2)+"***")+"</td>";
html+="<td width='125' align='center' valign='middle'>"+entry[i].voteAccount+'</td>';
html+='</tr>';
$(html).appendTo($('#ccbXc'));
}
});
});
});
</script>
相关文章推荐
- PHP+jQuery+Ajax实现分页效果 jPaginate插件的应用
- 用JQuery实现Ajax的简单小应用
- PHP+jQuery+Ajax实现分页效果 jPaginate插件的应用
- 第 8 章 jQuery 实现 Ajax 应用
- 三、jQuery--jQuery基础--jQuery基础课程--第8章 jQuery 实现Ajax应用
- PHP+jQuery实现Ajax分页效果:jPaginate插件的应用
- AJAX初级应用——jquery的实现
- Ajax——jquery快速实现html、json、xml的ajax应用
- 原生javascript实现Ajax和jQuery实现Ajax实例应用
- struts2框架通过jQuery实现AJAX应用
- PHP+jQuery实现Ajax分页效果:jPaginate插件的应用
- Ajax应用:使用jQuery和PHP实现功能开关效果
- Ajax应用:使用jQuery和PHP实现功能开关效果
- jQuery实现Ajax应用加载(load/getJSON/getScript/get/post/serialize/ajax/ajaxSetup/ajaxStart/ajaxStop)
- jquery实现百度类似搜索提示功能(AJAX应用)
- 传智播客 AJAX简单应用之JQuery实现
- .Net+C#+Jquery实现Ajax的json应用。解决parsererror错误
- JQuery实现Ajax
- springmvc+jquery 实现ajax页面无刷新请求
- 基于jQuery的AJAX和JSON实现纯html数据模板