无法将数据加载到jquery分页

时间:2018-04-02 07:21:21

标签: jquery pagination

我试图添加分页尝试了许多仍然没有运气

能够添加分页编号仍然需要下一个和上一个按钮

并且无法基于pagenumber来应用数据

var celivalue = 66;
var PerPageCount = 25;
    for (i = 2; i < celivalue; i++) { 

        if(celivalue>1) {

        searchresultDiv   = '<div class="panel panel-default searchhotel_box" data-id = '+i+' >'+
                            '<div class="panel-body" data-hotel-name='+branchName+' data-latitude='+lat+' data-longitude='+lang+' data-landmark='+landmark+'data-locationName='+branchlocation+' data-location='+cityId+' data-price='+productPrice+'><input type="hidden" value=\''+mealsVoucherContent+'\' id="mealsVoucherContent'+searchIndex+'">'+imgdisc+
                            '<div class="meal-details col-lg-9">';
        //console.log(searchresultDiv);
        }
        }
        tjq("#meal-searchlist").append(searchresultDiv);


        searchIndex = parseInt(searchIndex)+parseInt(1);
        tjq("a[rel^='prettyPhoto']").prettyPhoto({social_tools:false,deeplinking:false});
        //tjq("a[rel^='prettyPhotoTemp']").prettyPhoto({social_tools:false,deeplinking:false});

    });

     // to display buttons
     var pageulcount = '';
            for (i = 2; i < celivalue; i++) { 
                tjq(".pagination").append('<li class="page-item pgphoto active"  id="initialPhotoGalleryLoad'+i+'" data-id='+i+'><a class="page-link" href="javascript:void(0)">'+i+'</a></li>');

    } 

1 个答案:

答案 0 :(得分:0)

您需要的是数据表。它来自jquery。它就像

一样简单
<script>
$(document).ready(function(){
    $('#myTable').dataTable();
});
</script>

enter image description here

Reference