pagination with ajax 
December 12th, 2007, 08:35 AM
| | | pagination with ajax
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 | 
December 12th, 2007, 06:35 PM
| | | Re: pagination with ajax
newbie said the following on 12/12/2007 4:34 AM: Quote:
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/ | 
December 13th, 2007, 05:05 AM
| | | Re: pagination with ajax
On Dec 13, 12:28 am, Randy Webb <HikksNotAtH...@aol.comwrote: Quote:
newbie said the following on 12/12/2007 4:34 AM:
>> Quote:
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 | 
December 13th, 2007, 06:05 AM
| | | Re: pagination with ajax
newbie said the following on 12/13/2007 1:00 AM: Quote:
On Dec 13, 12:28 am, Randy Webb <HikksNotAtH...@aol.comwrote: Quote:
>newbie said the following on 12/12/2007 4:34 AM:
>> Quote:
>>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/ | 
December 13th, 2007, 06:15 AM
| | | Re: pagination with ajax
On Dec 13, 11:57 am, Randy Webb <HikksNotAtH...@aol.comwrote: Quote:
newbie said the following on 12/13/2007 1:00 AM:
>
>
> Quote:
On Dec 13, 12:28 am, Randy Webb <HikksNotAtH...@aol.comwrote: Quote: |
newbie said the following on 12/12/2007 4:34 AM:
| | > Quote: Quote:
>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.
| | > Quote: Quote:
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.
| | >> Quote:
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 | | Thread Tools | Search this Thread | | | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 220,989 network members.
|