The front-end writes directly 1, 2, 3, 4, 5.... When clicked, the corresponding number such as '4' is sent to the back-end The back-end writes SQL statements such as: select * from tab limit a *10,b
You should be able to understand this sql,
Note: If the database has a lot of data, using this SQL is not efficient
The front end sends the request according to the parameters required by the back end. What parameters are sent to get the corresponding data, then paging is realized. That is, every time the page is turned, ajax needs to be sent
For example. The background performs paging of 200 pieces of data per page and sends them to the front end, and returns the total number of pages. The front end can display different numbers of items such as 10, 20, 50, 100, etc. per page. The front-end does a calculation and corresponds the front-end page number to the background paging page number. Just take the data on each page directly from the 200 items. Like angular, ng-repeat="item in items.slice(page*10, 10)". Encapsulate a command and it works every time
I guess what the questioner needs is a front-end paging script:
If the poster happens to be using AngularJS, you can download and use my open source small project directly: ng-pagination.
The front-end writes directly
1, 2, 3, 4, 5....
When clicked, the corresponding number such as '4' is sent to the back-end
The back-end writes SQL statements such as: select * from tab limit a *10,b
You should be able to understand this sql,
Note: If the database has a lot of data, using this SQL is not efficient
The front end sends the request according to the parameters required by the back end. What parameters are sent to get the corresponding data, then paging is realized. That is, every time the page is turned, ajax needs to be sent
For example. The background performs paging of 200 pieces of data per page and sends them to the front end, and returns the total number of pages. The front end can display different numbers of items such as 10, 20, 50, 100, etc. per page. The front-end does a calculation and corresponds the front-end page number to the background paging page number. Just take the data on each page directly from the 200 items. Like angular, ng-repeat="item in items.slice(page*10, 10)". Encapsulate a command and it works every time