I want to use bootstrap tabs dynamically but I can't figure out how.
I basically need to get the name/id of the current tab and pass it into a PHP variable to then use in mysql WHERE
clause to determine what data to show for that tab.
I can see this on the Bootstrap documentation -
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
e.target // newly activated tab
e.relatedTarget // previous active tab
})
BUT it really doesn't help me much with my actual code.
My code works like so ->
- I get the tab titles from a
SELECT
query and a PHP while loop I then use a different
SELECT
query with aWHERE
clause that I need to be like -WHERE tab= $currenttab
to generate the info to be shown for each tab in a PHP while loop
**UPDATE - i've realised that what I need to know is how to use ajax with the above piece of code from bootstrap to POST a jquery variable to a php variable ?? **