I have an navigation where i load a page into a div called target. It works well but with a slightly annoying bug.
When I press a nav link it hides the current content and load the new one but then it hides the new one and show it again. In firebug i see that the script makes two requests for the page it’s trying to load. But i cant understand why it loads it twice?
Heres my jquery:
$(".nav").click(function(e){
e.preventDefault();
$(".footer").hide(0);
$('#target').html('<div class="content">Loding...</div>');
$.get(this.href, function(data) {
$("#target").hide(0, function(){
$("#sub_menu").fadeOut("fast");
$(".footer").show(0);
$(this).html(data).show(0);
});
});
});
Best regards!
This is from my comment on the OP:
Make sure your code for the click only loads
ONCE.