This article mainly combines jquery to do no refresh paging. The code is basically the same as the first two articles, slightly changed. The page link in this article is written in JS. First on the code:
page4.php
Ajax paging with jquery
page5.php
Reply to discussion (solution)
The core part of this article is the JS part of the Page_link () function, when the user click the page link, the script will bind to div.recordlist a load event, which is used to load the next page of content.
Take a look at the description of the Load event in the jquery Manual: Load the remote HTML file code and insert it into the DOM.
If we just do this:
$ (". Recordlist"). Load ($ (this). attr ("href")) so it is possible to flip the page, but the problem arises and the page link cannot be changed, so the paging link needs to be re-initialized inside the callback function, so the callback function always adds $ (". Page "). HTML (Pagination (page)); After you initialize the page, you need to rebind the click event to. Page A, so add page_link () to the callback function.
Because the object that is clicked is. Page A, after clicking, a jump occurs, so you must terminate the jump, so you must add return False to terminate ...
So much for the moment, welcome to shoot Bricks ~
You will make a page link and content into a template each time the request to the entire template load this template is OK
Reduce some JS operations
I have learned a lesson in ...
A few comments.
The 1 pagination function is intended to splice the output string, which is recommended for encapsulation as a template.
2 This paging, does not consider with the query condition.
What's the use of page5.php?
Good, thank you very much