Complete code by page using ajax and Douban search results.

Source: Internet
Author: User

Complete code by page using ajax and Douban search results.

Use the watercress api to obtain the paging result. The results are the same as those obtained from the background database. The difference is that you cannot 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 the total number of pages at the beginning of the page. I used a Fixed Total number of pages 65 (the total number of pages returned by searching javascript books ). Therefore, other books are not 65 pages and may contain multiple pages or fewer pages. This is not a bug.

Features

1. You do not need to contact the backend for the whole process. The front-end can be independent (I haven't found a complete example for a long time ).
2. Use pagination of bootstrap to create the page number and panel to create the panel for storing the result.

The Code is as follows:

<! DOCTYPE html> 

 

Reference

Http://bbs.csdn.net/topics/390734775? The logic processing section in page = 1 uses the code here, but it is modified.
Effect display

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.