I am very new to web programming. I am making a website that basically displays a long list of items. However, the list is too long to fit in one single page, so I decided to use pagination (page 1,2,3... Next
)
Currently, my php code is handling the backend such that it retrieves all data from the database and echo them back to the html frontend (jQuery ajax) which then displays it to the browser.
My question is should I retrieve all data when the site loads (at $(document).ready()
) or should I load the data when user requests to see certain page? Which one is a better design? Lastly, any example on pagination backend design?