$(function() {
var newHash = "",
$content = $("#content");
$('ul li a').click(function() {
window.location.hash = $(this).attr("href");
return false;
});
$(window).bind('hashchange', function(){
newHash = window.location.hash.substring(1);
url=newHash
if (newHash) {
$content
.fadeOut(200, function() {
url=url.replace('#','');
$('#loading').css('visibility','visible'); //show the rotating gif animation
$.ajax({
type: "POST",
url: "load_page.php",
data: 'page='+url,
success: function(msg){
if(parseInt(msg)!=0) //if no errors
{
$content.fadeIn(200, function() {
$('#content').html(msg);}); //load the returned html into pageContet
} $('#loading').css('visibility','hidden');//and hide the rotating gif
}
});
$('ul li a').removeClass("current");
$('ul li a[href="' + newHash + '"]').addClass('current');
});
};
});
$(window).trigger('hashchange');
});
Ahhh I found the Error the problem was that I set url to late... Thanks every person - robot who looked and helped me solve this ^^