Connecting Tech Pros Worldwide Help | Site Map

pagination with ajax

newbie
Guest
 
Posts: n/a
#1: Dec 12 '07
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
Randy Webb
Guest
 
Posts: n/a
#2: Dec 12 '07

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/
newbie
Guest
 
Posts: n/a
#3: Dec 13 '07

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:
hi all,
>
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
Randy Webb
Guest
 
Posts: n/a
#4: Dec 13 '07

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/
newbie
Guest
 
Posts: n/a
#5: Dec 13 '07

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:
hi Randy,
>
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
Closed Thread


Similar JavaScript / Ajax / DHTML bytes