No Refresh function We use a lot of, the following I would like to introduce to you an example, is to implement the PHP+AJAX implementation of non-flush scrolling loading data, the example is very simple everyone just follow the process to operate it can be OH.
1. First, we want to get the height of the browser viewable area page
2. Then, when scrolling the page, the thing to do is to calculate the total height of the page (when scrolling at the bottom, the page loads new data, so the total height of the page is dynamic), calculate the scrollbar position (the scrollbar position is also dynamic with the loading of the page height), and then construct a formula to calculate the relative proportions
3. When the scrollbar is near the bottom of the page, triggering the Ajax load, in this case we use the jquery Getjson method to send the request to the server result.php, the requested parameter is page, that is, the number of pages
4. If the request response returns JSON data successfully, parse the JSON data and append the data to the page Div#container, if no JSON data is returned, the data is all displayed
5. The complete jquery code is as follows
6.result.php
When scrolling to the bottom of the page, the front-end Ajax requests to result.php, the daemon will query the data table according to the requested number of pages: page, and the recordset in JSON format output returned to the front-end processing
7. Well, the introduction of this article to the end, go to see the effect of it.
Description
General asynchronous loading uses the Ajax calling method