jquery Ajax pagination Several instances (with source download)

Source: Internet
Author: User
Tags rar

Example 1


The core code is as follows

The code is as follows Copy Code

$.ajax ({
Url:url,
DataType: ' JSON ',
Data:data,
Success:callback
});


You can refer to the jquery website Pai http://api.jquery.com/jQuery.getJSON/

The code is as follows Copy Code

function Changepagination (pageid,liid) {
$ (". Flash"). Show ();
$ (". Flash"). FadeIn. html (' Loading ');
var datastring = ' pageid= ' + PageID;
$.ajax ({
Type: "POST",
URL: "pagedata.php",
Data:datastring,
Cache:false,
Success:function (Result) {
$ (". Flash"). Hide ();
$ (". Link a"). css (' Background-color ', ' #fff ');
$ ("#" +liid+ "a"). css (' Background-color ', ' #99A607 ');
$ ("#pageData"). HTML (result);
}
});
}

Php_ajax_jquery paging source Download: Http://file.111cn.net/upload/2013/10/super_paging.rar


Example 2

I don't use frames for pagination

The internet to find a modified php_ajax_jquery paging, using the Load method

The code is as follows Copy Code

     function Showloader () {
    $ ('. Search-background '). FadeIn;
    }
    function Hideloader () {
    $ ('. Search-background '). fadeout;
   };
    $ ("#paging_button li"). Click (function () {
    showloader ();
     $ ("#paging_button li"). css ({' Background-color ': '});
    $ (this). css ({' Background-color ': ' #006699 '});
    $ ("#content"). Load ("data.php?page=" + this.id, Hideloader);
    return false;
   });
    $ ("#1"). css ({' Background-color ': ' #006699 '});
    Showloader ();
    $ ("#content"). Load ("data.php?page=1", hideloader);

   });


P_a_jquery Paging: Http://file.111cn.net/upload/2013/10/p_aj_Pagination.rar


Example 3


Or use a Jqurey paging plugin

Just define a class and then modify the next argument

The code is as follows Copy Code

$ ("ul.paging"). Quickpager ();
$ ("Ul.paging2"). Quickpager ({pagerlocation: "both"});


    (function ($) {
    $.fn.quickpager = function (options) {
     var defaults = {
    pagesize:2,
    currentpage:1,
    Holder:null,
    pagerlocation: "After"
   };
    var options = $.extend (defaults, options);
    return This.each (function () {
    var selector = $ (this);
    var pagecounter = 1;
    selector.wrap ("<div class= ' Simplepagercontainer ' ></div>");
    Selector.children (). each (function (i) {

if (i < pagecounter*options.pagesize && i >= (pageCounter-1) *options.pagesize) {
$ (this). addclass ("Simplepagerpage" +pagecounter);
}
else {
$ (this). addclass ("Simplepagerpage" + (pagecounter+1));
PageCounter + +;
}

});

This example source download: Http://file.111cn.net/upload/2013/10/simplepager-master.rar

Related Article

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.