By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,708 Members | 1,529 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,708 IT Pros & Developers. It's quick & easy.

pagination with ajax

P: n/a
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
Dec 12 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
newbie said the following on 12/12/2007 4:34 AM:
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.
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/
Dec 12 '07 #2

P: n/a
On Dec 13, 12:28 am, Randy Webb <HikksNotAtH...@aol.comwrote:
newbie said the following on 12/12/2007 4:34 AM:
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.

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.

--
Thanks
neo
Dec 13 '07 #3

P: n/a
newbie said the following on 12/13/2007 1:00 AM:
On Dec 13, 12:28 am, Randy Webb <HikksNotAtH...@aol.comwrote:
>newbie said the following on 12/12/2007 4:34 AM:
>>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.
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.

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.
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.

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

P: n/a
On Dec 13, 11:57 am, Randy Webb <HikksNotAtH...@aol.comwrote:
newbie said the following on 12/13/2007 1:00 AM:
On Dec 13, 12:28 am, Randy Webb <HikksNotAtH...@aol.comwrote:
newbie said the following on 12/12/2007 4:34 AM:
>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.
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.
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.

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.
--
Thanks
neo
Dec 13 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.