标签:tle produce map items ice mod result ping 获取
function fun_page(){ var url="${root}/book/page"; 获取一个地址 var data={"index":index,"size":size,"step":step}; 以键值对封装分页的参数:第几页,显示的行数,起始页 $.getJSON(url,data,function(result){ 到该地址(路由)去 $(result.items).each(function(){ var row=$(‘ <tr></tr>‘); row.append(‘<td>‘+this.bid+‘</td>‘); row.append(‘<td>‘+this.btitle+‘</td>‘); row.append(‘<td>‘+this.bauthor+‘</td>‘); row.append(‘<td>‘+this.bpublic+‘</td>‘); row.append(‘<td><button class="btn text-primary btnupd" lang="‘+this.bid+‘" data-toggle="modal" data-target="#myModal">修改</button>‘+ ‘<button class="btn text-primary btndel" lang="‘+this.bid+‘">删除</button></td>‘); row.appendTo($("#tblbook tbody")); });
@ResponseBody @RequestMapping(value="/book/page",method=RequestMethod.GET, produces={"application/json;charset=utf-8"}) public String method1(@RequestParam(name="index",defaultValue="1")int index, 从封装的data里面获取 @RequestParam(name="size",defaultValue="1")int size, @RequestParam(name="step",defaultValue="1")int step){ String json=JSONObject.toJSONString(bookService.getBookList(index, size, step, "")); 去数据库里面查询,以json的形式返回 return json; }
$(result.items).each(function(){ //这个items是分页实体类里的一个当前页数据List
var row=$(‘ <tr></tr>‘); //然后一个个的赋值到html桌面
row.append(‘<td>‘+this.bid+‘</td>‘);
row.append(‘<td>‘+this.btitle+‘</td>‘);
row.append(‘<td>‘+this.bauthor+‘</td>‘);
row.append(‘<td>‘+this.bpublic+‘</td>‘);
row.append(‘<td><button class="btn text-primary btnupd" lang="‘+this.bid+‘" data-toggle="modal" data-target="#myModal">修改</button>‘+
‘<button class="btn text-primary btndel" lang="‘+this.bid+‘">删除</button></td>‘);
row.appendTo($("#tblbook tbody"));
});
标签:tle produce map items ice mod result ping 获取
原文地址:https://www.cnblogs.com/lanbao5339/p/14111466.html