J'ai suivi ce grand tutoriel pour « ajax » mon blog: http://www.deluxeblogtips.com/2010/05/how-to-ajaxify-wordpress-theme.html Mais il crée quelques problèmes et je pense que le problème est dans le hachage qui crée ajax . Donc, après le chargement du contenu, comment puis-je supprimer le hachage de l'URL? copier mon code ici:Retirez le hachage après Ajax chargement (j'ajaxing 8 wordpress))
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');
});
Merci beaucoup à tous!
Salut Alberto, si une réponse fonctionne pour vous, vous pouvez voter et la marquer comme "acceptée" - la section "Réponses" n'est pas le bon endroit pour un "Merci". – artlung
Merci Alberto! J'espère que vous appréciez StackOverflow! – artlung