页面打开加载10条数据,点击更多加载更多数据

$(function () {
    var pageStart = 1;
    var pageCounter = 10;
    var id = $("#convergeId").val();
    /*首次加载*/
    userJoinList(pageStart, pageCounter);

    function userJoinList(nextPage, pageSize) {
        $.ajax({
            type: 'post',
            url: app.base + 'xxx' + id,
            data: {"pageView.currentPage": nextPage, "pageView.pageSize": pageSize},
            dataType: 'json',
            success: function (reponse) {
                // console.log(reponse);
                // alert(reponse.voList.length);
                var data = reponse.voList;
                $("#loanCurrentPage").val(reponse.currentPage);
                var result = '';
                for (var i = 0; i < data.length; i++) {
                    result += '<tr><td>' + data[i].rownum_ + '</td> <td>' + data[i].userId + '</td> <td>' + data[i].joinamount + '</td> <td>' + data[i].joinDate + '</td>  </tr>'
                }
                $('#userListTable tbody').append(result);
                /*隐藏more*/
                if (nextPage == reponse.pageCount) {
                    $(".js-load-more").hide();
                } else {
                    $(".js-load-more").show();
                }
            }
        });
    }

    $("#userJoinListM").click(function () {
        var currentPage = $("#loanCurrentPage").val();
        var nextPage = parseInt(currentPage) + 1;
        // alert(currentPage+'-'+nextPage);
        userJoinList(nextPage, 10);
    });
});

猜你喜欢

转载自blog.csdn.net/cccdf_jjj/article/details/81631200
今日推荐