zoukankan      html  css  js  c++  java
  • 前端分页+ajax


    <table class="table table-bordered">
    <tr>
    <td>每页4条数据</td>
    <td>当前第<span id="pageIndex">1</span>页</td>
    <td>共<span id="allCount">1</span>条数据</td>
    <td>共<span id="pageCount">1</span>页</td>
    <td><button class="form-control" onclick="show(1)">首页</button></td>
    <td><button class="form-control" onclick="show(pageIndex+1)">下一页</button></td>
    <td><button class="form-control" onclick="show(pageIndex-1)">上一页</button></td>
    <td><button class="form-control" onclick="show(pageCount)">尾页</button></td>
    </tr>
    </table>
    @section scripts{
    <script>
    var pageIndex = 1;
    var pageCount = 1;
    $(function () {
    show(1);
    })
    function show(page) {
    var obj = {};
    obj.pageSize = 4;
    obj.pageIndex = page;
    obj.Zt = $("#zt").val();
    obj.Lsh = $("#lsh").val();
    $.ajax({
    url: "http://localhost:44372/api/SP/Show",
    type: "get",
    data: obj,
    success: function (d) {
    pageIndex = d.pageIndex;
    pageCount = d.pageCount;
    $("#pageIndex").text(d.pageIndex);
    $("#pageCount").text(d.pageCount);
    $("#allCount").text(d.allCount);
    $("#tb").empty();
    $(d.shenPiModels).each(function () {
    $("#tb").append(
    '<tr>' +
    '<td>' + this.SId + '</td>' +
    '<td>' + this.Zt + '</td>' +
    '<td>' + this.Spsj + '</td>' +
    '<td>' + this.Lsh + '</td>' +
    '<td>' + this.Spzt + '</td>' +
    '<td>' + (this.Spzt == '未发送' ? '<input id="Button1" type="button" value="未发送" onclick="Upd('+this.SId+')"/>' : this.Spzt=='已发送'?"已发送": this.Spzt == '待审核' ? '<input id="Button1" type="button" value="待审核" onclick="Upd(' + this.SId + ')" />' : "审核通过") + '</td>' +

    '</tr>'

    )
    });
    }
    })
    }

  • 相关阅读:
    CSS3-loading动画(三)
    CSS3-loading动画(二)
    CSS3-loading动画(一)
    CSS reset ---- 个人理解与惯用方式
    HTTP常见状态码 200 301 302 404 500
    c#导出文件,文件名中文乱码解决方法。
    对FineU框架Grid多表头合计行导出Excel的回顾
    JS数据类型
    细数使用View UI(iView)开发中遇到的坑
    源生JS实现点击复制功能
  • 原文地址:https://www.cnblogs.com/wypd/p/13431462.html
Copyright © 2011-2022 走看看