function ajax_more () { $ type = isset ( $ _POST ? [ 'type']) (int) INPUT Yin :: _ ( 'post.type'): 0 ; // parameters passed $ Page = isset ( $ _POST [ ' Page '?]) (int) Yin :: _ the INPUT (' post.page '): 2 ; // item number displayed per page $ pageSize = 10 ; // check out the list of data $ list = $ the this -> Product -> get_page_list ( $ type , '', $ Page , $ pageSize ); echo json_encode ( $ List ); Exit; }
// drop down loading js code var Page = 2, // Record Length // Boolean parameter, determines whether to allow loading BOOL = to true , // total height of the page height across the recording // ,, ST = $ (Document) .innerHeight (); // $ ( 'loading.') offset () Top;.. // less time to make a list of compatible content processing IF (! {BOOL) $ ( '.loading' ) .hide (); $ ( '.nothing_all' ) the .Show (); } function Refresh () { IF (! BOOL) { return ;} BOOL = to false ; //console.log(page); var data = { 'page' : page, 'pagesize' : {:$pagesize:}, 'type' : {:$type:} } $.post( '/index.php?m=shop&c=list&a=ajax_more', data, function(d){ if (d.length>0) { var html = ''; for (var i = 0; i < d.length; i++) { var v = d[i]; //具体的代码 }; $('#append').append(html); if (d.length==data.pagesize) { page++; st = $(document).innerHeight(); bool = true; } }else{ bool = false; } },'json'); } $(window).scroll(function(event) { var$ = S (Document) .scrollTop () + $ (window) .height (); IF (S> (ST-100)) { // reserve space bottom 100px IF (! {BOOL) $ ( '.loading' ) .hide (); $ ( '.nothing_all' ) the .Show (); return to false ; } the else { Refresh (); } } });