| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Title</title> | |
| </head> | |
| <script src="http://code.jquery.com/jquery.js"></script> | |
| <script src="../bootstrap/js/bootstrap.min.js"></script> | |
| <body> | |
| <table border="1px" id="head"> | |
| <thead class="success"> | |
| <td>uid</td> | |
| <td>username</td> | |
| <td>pwd</td> | |
| </thead> | |
| </table> | |
| <button id="lastbtn">上一页</button> | |
| <button id="nextbtn">下一页</button> | |
| <script> | |
| $(function () { | |
| var pagesize=3; | |
| var pagenum=1; | |
| $.ajax({ | |
| url:"/pageservlet", | |
| type:"post", | |
| data:{"pagesize":+pagesize,"pagenum":+pagenum}, | |
| dataType:'json', | |
| success:function (data) { | |
| //console.log("获取到了数据"); | |
| //console.log(data); | |
| $.each(data,function(index,value){ | |
| var chitr=$("<tr/>"); | |
| console.log(value); | |
| // console.log("22222") | |
| $.each(value,function (i,valuetd) { | |
| //console.log("进入"); | |
| var chitd=$("<td/>"); | |
| console.log(i); | |
| if(i=="uid"){ | |
| chitd.html(value.username); | |
| } | |
| if(i=="username") | |
| { | |
| chitd.html(value.password); | |
| } | |
| if(i=="password") | |
| { | |
| chitd.html(value.uid); | |
| } | |
| //chitd.html(valuetd); | |
| console.log(valuetd) | |
| $(chitr ).append(chitd); | |
| }) | |
| //console.log( index , listReceive[index] ); | |
| //创建节点 | |
| $("table#head").append(chitr); | |
| }); | |
| },error(e){ | |
| console.log("2222") | |
| } | |
| }) | |
| //上一页 | |
| $("#lastbtn").on("click",function () { | |
| pagenum=pagenum-1; | |
| $("thead").siblings().empty(); | |
| $.ajax({ | |
| url:"/pageservlet", | |
| type:"post", | |
| data:{"pagesize":+pagesize,"pagenum":+pagenum}, | |
| dataType:'json', | |
| success:function (data) { | |
| console.log("获取到了数据"); | |
| console.log(data); | |
| $.each(data,function(index,value){ | |
| var chitr=$("<tr/>"); | |
| console.log(value); | |
| // console.log("22222") | |
| $.each(value,function (i,valuetd) { | |
| console.log("进入"); | |
| var chitd=$("<td/>"); | |
| console.log(i); | |
| if(i=="uid"){ | |
| chitd.html(value.username); | |
| } | |
| if(i=="username") | |
| { | |
| chitd.html(value.password); | |
| } | |
| if(i=="password") | |
| { | |
| chitd.html(value.uid); | |
| } | |
| //chitd.html(valuetd); | |
| console.log(valuetd) | |
| $(chitr ).append(chitd); | |
| }) | |
| //console.log( index , listReceive[index] ); | |
| //创建节点 | |
| $("table#head").append(chitr); | |
| }); | |
| },error(e){ | |
| console.log("2222") | |
| } | |
| }) | |
| }) | |
| //下一页 | |
| $("#nextbtn").on("click",function () { | |
| pagenum=pagenum+1; | |
| $("thead").siblings().empty(); | |
| $.ajax({ | |
| url:"/pageservlet", | |
| type:"post", | |
| data:{"pagesize":+pagesize,"pagenum":+pagenum}, | |
| dataType:'json', | |
| success:function (data) { | |
| console.log("获取到了数据"); | |
| console.log(data); | |
| $.each(data,function(index,value){ | |
| var chitr=$("<tr/>"); | |
| console.log(value); | |
| // console.log("22222") | |
| $.each(value,function (i,valuetd) { | |
| //console.log("进入"); | |
| var chitd=$("<td/>"); | |
| console.log(i); | |
| if(i=="uid"){ | |
| chitd.html(value.username); | |
| } | |
| if(i=="username") | |
| { | |
| chitd.html(value.password); | |
| } | |
| if(i=="password") | |
| { | |
| chitd.html(value.uid); | |
| } | |
| //chitd.html(valuetd); | |
| console.log(valuetd) | |
| $(chitr ).append(chitd); | |
| }) | |
| //console.log( index , listReceive[index] ); | |
| //创建节点 | |
| $("table#head").append(chitr); | |
| }); | |
| },error(e){ | |
| console.log("2222") | |
| } | |
| }) | |
| }) | |
| }) | |
| </script> | |
| </body> | |
| </html> |
分页
最新推荐文章于 2025-02-05 08:00:00 发布
8073

被折叠的 条评论
为什么被折叠?



