I have an web application that when you go onto a page a ajax call is made to get all the data from the database. It stores the data into a Global variable and as the user scrolls down the page it loads more into the page. Now I would like to be able to call the database and grab lets say 20 items from the database as they scroll down, instead of getting them all on the page load. Is there a good way of doing this? Thanks for any help.
here is what I would like to do
1.Page load (get first 20 items)
2.As they scroll down near bottom(Ajax call to get the next 20 and append it to table, list etc)
mysql help for the correct query.
MySQL supports the
LIMITkeyword on selects, e.g.:It accepts up to two arguments. If you supply one, it’s the number of rows (max) to return. If you supply two, the first is an offset (skip) value, and the second is a limit. E.g. (from the docs):
Combine
LIMITwithORDER BYand barring inserts, you have paging.