View Full Version : PHP Is it possible to load php query after the page loads?
tenj
April 22nd, 2009, 01:18 PM
I think I am over-thinking this problem. I am trying to do a simple query with php into mysql and show the results of the data on a page. The problem is that when I try to pull 500 records on the page, it takes a long time to load the page.
I was wondering if it was possible to make the query load after the page has completly loaded, or if there was some way to use a combination of jquery/json to load the data.
icio
April 22nd, 2009, 06:27 PM
You could certainly use JQuery to do it. You'd just need to request your 'search.php?query=i+want+this' and replace the contents of the results element `<div id="results">Loading…</div>` so that they show up.
Have you considered pagination?
tenj
April 22nd, 2009, 06:56 PM
I have considered pagination, I just have not found a decent tutorial.
icio
April 23rd, 2009, 06:30 AM
Finding one is easy
php pagination
It would be considerably easier to do pagination than use an ajax request to get the results after loading the page.
Esherido
May 1st, 2009, 07:09 AM
MXHR (http://blog.digg.com/?p=621) is also a possible solution. Have another PHP page that just spits out result data over MXHR and your database results will slowly flow into the entire page.
utsav
May 13th, 2009, 12:29 PM
Displaying 500+ records in a page is very big.
Either use the idea that icio said. or create pagination. And i guess pagination would be better.
Find a easy and nice working pagination tutorial here http://rathour.com.np/blog/archives/38
icio
May 13th, 2009, 01:05 PM
I said both. Please read the thread.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.