Remove the hash after Ajax loading (I’m ajaxing wordpress 8-) )

I followed this great tutorial to”ajax” my blog:http://www.deluxeblogtips.com/2010/05/how-to-ajaxify-wordpress-theme.html
But it creates some problems and I think the problem is in the hash that ajax creates.
So, after the content is loaded, how can I remove the hash from the url?
I copy my code here:

    jQuery(document).ready(function($) { 
    var $mainContent = $("#content"), 
        siteUrl = "http://" + top.location.host.toString(), 
        url = ''; 

    $(document).delegate("a[href^='"+siteUrl+"']:not([href*=/wp-admin/]):not([href*=/wp-login.php]):not([href$=/feed/]):not([href*=/go.php]):not(.comment-reply-link)", "click", function() { 
        location.hash = this.pathname;
$('html, body').animate({scrollTop:0}, 'fast');
        return false; 
    }); 

    $("#searchform").submit(function(e) { 
        location.hash = '?s=' + $("#search").val(); 
        e.preventDefault(); 
    }); 

    $(window).bind('hashchange', function(){ 
        url = window.location.hash.substring(1); 

        if (!url) { 
            return; 
        } 

        url = url + " #inside"; 

        $mainContent.html('<div id="loader">Caricamento in corso...</div>').load(url, function() { 
            //$mainContent.animate({opacity: "1"});
            scriptss();
        }); 
    });

    $(window).trigger('hashchange'); 
});

Thank all very much!

Related posts

Leave a Reply

1 comment

  1. So you want to remove the hash? Just set it to an empty string.

    window.location.hash = '';
    

    This will set your hashchange event, but it looks like you check and just return if the hash is empty.