Below is the jquery code I am using for my AJAX tabs
Is there a better way that would be faster in the browser, I don't care about fancy transitions.
<script type="text/javascript">
var pageUrl = new Array();
pageUrl[1] = "HOMEbulletin.inc.php";
pageUrl[2] = "HOMEfriendstatus.inc.php";
pageUrl[3] = "HOMEbulletin.inc.php";
function loadTab(id){
if (pageUrl[id].length > 0){
$("#loading").show();
$.ajax({url: pageUrl[id], cache: false, success: function(message) {
$("#tabcontent").empty().append(message);
$("#loading").hide();
}
});
}
}
$(document).ready(function(){
$("#loading").hide();
$("#tab1").click(function(){
loadTab(1);
$('div.tabs2 ul.HOMEtabs a').removeClass('selected');
$(this).addClass('selected');
});
$("#tab2").click(function(){
loadTab(2);
$('div.tabs2 ul.HOMEtabs a').removeClass('selected');
$(this).addClass('selected');
});
$("#tab3").click(function(){
loadTab(3);
$('div.tabs2 ul.HOMEtabs a').removeClass('selected');
$(this).addClass('selected');
});
});
</script>