I'm trying to build a webpage which contains some tabs, by clicking on a tab, it will use AJAX to load content below the tabs.
The problem: In older versions of Internet Explorer clicking on a tab will result in getting redirected to the tab link, instead of loading the content behind that link via AJAX.
My html code:
<ul id="nav">
<li><a href="page_1.html">Page 1</a></li>
<li><a href="page_2.html">Page 2</a></li>
<li><a href="page_3.html">Page 3</a></li>
</ul>
<div id="ajax-content">This is default text, which will be replaced</div>
My Jquery code:
$(document).ready(function() {
$("#nav li a").click(function() {
$("#ajax-content").empty().append("<div id='loading'><img src='images/loading.gif' alt='Loading' /></div>");
$("#nav li a").removeClass('current');
$(this).addClass('current');
$.ajax({
url: this.href,
success: function(html) {
$("#ajax-content").empty().append(html);
}
});
return false;
});
});