Ajax combined with watercress search results for pagination complete code _ajax related

Source: Internet
Author: User
Tags prev

Use the Watercress API to get pagination results. Equivalent to the results obtained from the background database. The difference is that you can't know the number of pages in advance. Although the total number of pages can be obtained through the request API, because Ajax is asynchronous, it makes no sense to give a total number of pages at the beginning of a page. I used a fixed total of 65 pages (the total number of pages returned by searching for JavaScript books). So other books are not 65 pages, there will be multiple pages or fewer pages of the situation, this is not a bug.

Characteristics

1, the whole process does not need to contact the background, the front-end independent can (I have been looking for a long time did not find a complete example).
2, using Bootstrap's pagination to make page numbers and panel to make placement results.

The code is as follows

<!  DOCTYPE html>  

Reference

The logical processing part of the Http://bbs.csdn.net/topics/390734775?page=1 book uses the code here, but it is modified.
Effect Show

https://yuwanlin.github.io/general/%E5%88%86%E9%A1%B5/%E7%BB%93%E5%90%88%E8%B1%86%E7%93%A3%E6%90%9C%E7%B4%A2% E7%bb%93%e6%9e%9c%e8%bf%9b%e8%a1%8c%e5%88%86%e9%a1%b5.html

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.