"Original" Pagination Advanced Tutorial: Making Ajax paging with jquery

Source: Internet
Author: User
This article mainly combines jquery to do no refresh paging. The code is basically the same as the first two articles, slightly changed. The page link in this article is written in JS. First on the code:
page4.php

 
  Ajax paging with jquery
 
  
 
  
  
  • -


page5.php

 
   
 
  
  
  • -


Reply to discussion (solution)

The core part of this article is the JS part of the Page_link () function, when the user click the page link, the script will bind to div.recordlist a load event, which is used to load the next page of content.
Take a look at the description of the Load event in the jquery Manual: Load the remote HTML file code and insert it into the DOM.

If we just do this:
$ (". Recordlist"). Load ($ (this). attr ("href")) so it is possible to flip the page, but the problem arises and the page link cannot be changed, so the paging link needs to be re-initialized inside the callback function, so the callback function always adds $ (". Page "). HTML (Pagination (page)); After you initialize the page, you need to rebind the click event to. Page A, so add page_link () to the callback function.

Because the object that is clicked is. Page A, after clicking, a jump occurs, so you must terminate the jump, so you must add return False to terminate ...



So much for the moment, welcome to shoot Bricks ~

You will make a page link and content into a template each time the request to the entire template load this template is OK

Reduce some JS operations

I have learned a lesson in ...

A few comments.
The 1 pagination function is intended to splice the output string, which is recommended for encapsulation as a template.
2 This paging, does not consider with the query condition.

What's the use of page5.php?

Good, thank you very much

  • 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.