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

JavaScript load and pagination in a div

P: 33
eh, ok this is a little bit complicated, i have a webpage that has 11 tabs that i currently use jquery to "slide" open and close each div that corresponds to one of the 11 tabs. also, for each tab im running a mysql query, so when you load the page its runs 11 querys and loads all the information at once. to me this is very poorly coded, and what i would like to have it do it when you load the page, only 1 query is run and then once you click on one of the tabs it will do an ajax call and query the database just for that spacific tab that was clicked, and then also allow it to pageinate, to keep the querys from becomming to long, and i want to do it all inside of a div that is along side this menue bar with all the tabs. anways spent the last few days running various scripts and trying various things but still no luck, i can load a html page inside, but not a php page. which is blank with just a query and an "echo" of the data... any ideas? i want this to be coded smart. thanks guys, sorry for the long comment
Jul 16 '12 #1
Share this Question
Share on Google+
2 Replies

Claus Mygind
P: 571
I do not use jQuery, but the concept is the same for ajax anyway.

With ajax you do not reload the page (or in your case the tab), you would simply unhide the tab. You should be loading all of the tabs (without data) when the page is first streamed out.

The purpose of ajax as you stated yourself is to only return the needed data to back fill the screen.

what you need to do is
1) on pagination initiate a query, In your control block where you send the ajax request include the tab #

2) on response from ajax request write a switch that will act on the tab # parameter you sent, which will back fill the control elements for that tab.

3) then use your jQuery to unhide the tab selected.
Jul 16 '12 #2

P: 33
Thanks for the reply. Here is the problem. For some reason when I click on the tabs it will open my hidden div. but Is blank when I try it with a php file. Even left the php file simple with just an echo. Still nothing. However. If I use a regular HTML page. When I click on the tab it will load that... Any ideas?
Jul 16 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.