jquery's Paging plugin Pagination.js

Source: Internet
Author: User

Page Pagination Method:

Ajax gets data from the background and pages in the foreground

      

$.ajax ({type: "POST", Url:API_CONFIG.getNews, Data:JSON.stringify (params),                DataType: "JSON", ContentType: ' Application/json;charset=utf-8 ', success:function (data) { if (data! = NULL) {if (data. STATUS = = True) {var newslist = data.                        DATA; var count = data.                        COUNT;                        var PageCount = Math.ceil (count/pagesize);                            if (null! = Newslist && "! = newslist) {var html =" "; for (i = 0; I<Newslist.length; i++) {html += ' <div class= ' advisorycenter_news_mould ' > '; HTML += ' <div class= ' advisorycenter_news_picture ' > '; HTML += '  '+ Newslist[i].imgurl + ' "/>'; HTML + = '</Div>'; HTML + = '<Divclass= "Advisorycenter_news_text">'; HTML + = '<Divclass= "Advisorycenter_news_title">'; HTML + = '<ahref= "News.html?id= ' + newslist[i].id + '">' + Newslist[i].newstitle + '</a>'; HTML + = '</Div>'; HTML + = '<Divclass= "Advisorycenter_news_information">'; HTML + = '<span>' + Newslist[i].newsoriginate + '</span>'; HTML + = '<span></span>'; HTML + = '<span>' + Newslist[i].newstype + '</span>'; HTML + = '<span>' + Newslist[i].starttime + '</span>'; HTML + = '<span></span>'; HTML + = '</Div>'; HTML + = '<Divclass= "Advisorycenter_news_article">' + Newslist[i].newsdesc + '</Div>'; HTML + = '</Div>'; HTML + = '</Div>'; } HTML + = '<Divclass= "M-style m-box"></Div>‘; $ (' #newsList '). HTML (HTML);//Paging $ (".                                M-box "). Pagination ({pagecount:pagecount, coping:true,                                Current:pageindex, homepage: ' Home ',                                EndPage: ' Last ', Prevcontent: ' last page ', nextcontent: ' next page ',                                Callback:function (API) {Pagecallback (API); }                            });} else {document.getElementById (' newslist '). InnerHTML = "No Data"}                            } else {layer.msg ("", {time:1500, Content:data.                    MSG}); }} else {layer.msg ("", {time:1500, con                Tent: ' Service exception '});                    }}, Error:function () {layer.msg ("", {time:1500,            Content: ' Query news Failed '}); }        });

Page Flipping method

Paging calls       function Pagecallback (API) {        var pageIndex = api.getcurrent ()//Get Current Code        querynewslist (PageIndex);    }

jquery's Paging plugin Pagination.js

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.