very easy example:
<div id="tabs">
<ul>
<li><a href="tab_index.php" id="ctx-1">Tab 1</a></li>
<li><a href="tab_index.php" id="ctx-5">Tab 2</a></li>
</ul>
<div class="tabs-spacer" style="height:0px"></div>
</div>
And now the problem: I'd like to know which tab "calls" tab_index.php.
The easiest solution would be: tab_index.php?ctx=1, but i don't want to use GET for security reasons.
Is is possible at all?
the Fiddle: http://jsfiddle.net/Sledgehammer/M8jYA/
If you don't want to use GET, you could use POST:
<div id="tabs">
<ul>
<li>
<form action="tab_index.php" method="POST">
<input type="submit" value="Tab1" name="tab" />
</form>
</li>
<li>
<form action="tab_index.php" method="POST">
<input type="submit" value="Tab2" name="tab" />
</form>
</li>
</ul>
<div class="tabs-spacer" style="height:0px"></div>
</div>
Demo: http://jsfiddle.net/KTmga/ (check your browser's network console)
You could bind the click on your tab link $('a[href="tab_index.php"]')
$(function() {
$('a[href="tab_index.php"]').click(function(){
var clickedTab = $(this).attr("id"));
});
});
jsFiddle example - http://jsfiddle.net/Zdw37/6/