Get the App
SLTechnology News&Howtos  ›  Development  › 

How Ajax reads data and displays it in pages

Shulou Source: shulou.com Published: 2022-06-03 07:16:33 09月30日 Update

This article will explain in detail how Ajax reads the data and displays it in pages. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

I think it is still necessary to present my ajax page to you. I will first talk about the implementation core of this ajax page, and then we will look at the example effect. The so-called ajax page and the traditional data page, the code on the server side is basically the same. What we mainly do is to use ajax to change the requested page number without refreshing it. And the number of pages to be displayed to be sent to the server. Click on this URL to see the data you want to request: "ajax_page.asp?action=read&pagecount=3 & current_page=1"

In this URL, pagecount represents how many pieces of data to display on each page, and current_page represents the page number to be solicited. The server sends back the data you want to request according to these two parameters.

This is the front-end ajax code:

The copy code is as follows:

Ajax data paging

Body {

Font-size:12px

}

Table {

Border-collapse:collapse

}

Li {

List-style:none

Border:1px solid

Width:20px

Height:20px

Text-align:center

Margin:5px

Padding:2px

Float:left

Cursor:pointer

}

The default display is 5 pieces of data per page. You can set the number of entries per page in the text box below.

Enter the number of entries to display per page:

Tags: Data page numbers elements services functions parameters events code numbers variables tutorials objects content that is front end client client text browser browsing Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi MySQL macOS OPPO Reno Shulou Tech Info