I have a page with some tabs on it and upon clicking on certain tabs, other pages are loaded dynamically. The only problem is that these pages load every time the tabs are clicked on. How do I make them load only once, at the first click?
The code that I use is this:
$(document).ready(function(){
$(".tab-content").hide();
$("#one").show();
$("a.tab-name").click(function(){
$(".tab-name-active").removeClass("tab-name-active");
$(this).addClass("tab-name-active");
$(".tab-content").fadeOut();
var content_show=$(this).attr("title");
if (content_show === 'three') {
$("#"+content_show).load('new-page.php', function() {
$("#sorttable").tablesorter({
headers: {0: {sorter: false}}
});
});
}
else if (content_show === 'four') {
$("#"+content_show).load('new-page-2.php');
}
$("#"+content_show).delay(100).fadeIn('slow');
return false;
});
});
Thanks!