views:

1081

answers:

2

I am creating a calendar list system, that has tabbed dates on top, with data listings below it. I think I know how to use JSON and load the data with JQUERY into a div, but I am not sure how to load it dynamically, based on which tab I selected.

How would I do this, and what's the best practice? I am using the codeignitor framework.

A: 

You need to load the tabs through AJAX only onClick of Show of the tabs.

Pradeep
+2  A: 

Add an event listener to each tab that calls a function which will control what to send to the ajax function.

The tab itself would store the date somewhere on it, for an example lets say your tab is set up like this

<ul>
   <li><span class="something">08/09</span></li>
</ul>

Now have the event listener bind to .something, which calls a function that passes the date of the tab onto the php back end via ajax.

called_by_event(e)
{
   call_ajax_fnc(this.innerHTML);
}

The back end then interprets the date and returns the valid information.

Ian Elliott
I am still a beginner in the programming, learning how to use all these languages in conjunction. Right now I created an array with PHP to generate a new <li> I will need to do this via a different approach to make all the elements work together. Its always set to today + 7 days, Each tab will load 5 JSON data for that day. I not sure how to write the dynamic tabs, with the dates dynamic then linking the date to the content div below it.
matthewb