JQuery Ajax的分页查询:
- <script type="text/javascript">
- window.οnlοad=function(){
- var page="[<a href='https://www.baidu.com'>0<a>]";
- $.ajax({
- url: "http://localhost:8086/ee/student/getStudentList",
- type: "GET",
- data: {"rows":4,"page":2},
- contentType:'application/json;charset=UTF-8',
- success: function(data) {
- console.log(data);
- var con;
- $.each(data.rows,function(index,rows){
- con+="<tr>"+"<th>"+rows['id']+"</th>"+"<th>"+rows['name']+"</th>"+"<th>"+
- rows['age']+"</th>"+"<th>"+rows['sex']+"</th>"+"<th>"+rows['grade']+"</th>"+"<th>"+rows['student_class']+"</th>"+"<th>"+rows['profession']+"</th>"+
- "</th>"+"<th>"+'<button class="btn-update" οnclick="update()" id="idValue">修改</button>'+"</th>"+"<th>"+'<button class="btn-delete" οnclick="shanchu('+rows['id']+')">删除</button>'+"</th>"+"</tr>";
- })
- page+="[<a href='https://www.baidu.com'>1<a>]"+"[<a href='https://www.baidu.com'>2<a>]"+"[<a href='https://www.baidu.com'>3<a>]"+"[<a href='https://www.baidu.com'>4<a>]";
- console.log(con);
- $("#show").html(con);
- $("#showpage").html(page);
- },
- error: function(data){
- alert("传输出错");
- }
- });
- }