pagination with ajax

N

newbie

hi all,

what i am trying to do is fetching results from mysql through a php
script using ajax and showing them in paginated manner on the browser.
I am getting a json response. Currently i am showing 15 results at a
time. if the user wishes to see next set of results, then a ajax call
is made again which fetches the next 15 results. I want to know what
can be the maximiun number of results in response that is optimal for
browser. I am asking this because the database has about 5000 results.
Should i fetch them all at once and then paginate whole results solely
on browser or 15 at a time is better.

Thanks
neo
 
N

newbie

newbie said the following on 12/12/2007 4:34 AM:



What is "optimal" for each user is going to be specific to that user.
Retrieving 5000 results on a high end broadband connection is going to
be a lot more "optimal" than it would be on a dial up connection.

Instead of 15 results the first time, get 30. When the user requests
results 16-30, you show them and get 31-45 from the server. When the
user requests 31-45, you show them and get 46-60 from the server and so
on. Then, it is almost instant when they make the request and you can
load the next 15 in the background. It will also keep you from having to
retrieve 5,000 results every time.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/


hi Randy,

Thanks. That is better i think .
I have one more query. Should i apply the same behavior for previous
button also OR should i cache the results that i have previously
received. In this way no request will be made while previous button is
clicked any time.
 
N

newbie

newbie said the following on 12/13/2007 1:00 AM:






Sounds like you answered yourself. You have the information, no point in
trashing it and retrieving it again unless 5,000 results is going to
impact the performance of the page.

Don't quote signatures.



Number of results to be kept at the browser is also a major concern.
How many results can affect the performance of the browser or crash
it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top