A small and possibly simple consultation. I'm loading pages via Ajax like this:
jQuery("div.menu a").addClass("ajax");
var hash = window.location.hash.substr(1);
var href = jQuery('.ajax').each(function(){
var href = jQuery(this).attr('href');
if(hash==href.substr(0,href.length-5)){
var toLoad = hash+'.html #wrapper';
jQuery('#wrapper').load(toLoad)
}
});
jQuery('a.ajax').click(function(){
var toLoad = jQuery(this).attr('href')+' #wrapper';
jQuery('h2').fadeOut('slow');
jQuery('#wrapper').animate( {
top: '300px',
opacity: 0
} ).animate({top:'-300px'}).hide('normal',loadContent);
window.location.hash = jQuery(this).attr('href').substr(0,jQuery(this).attr('href').length-5);
function loadContent() {
jQuery('#wrapper').load(toLoad,'',showNewContent())
}
function showNewContent() {
jQuery('#wrapper').show('slow').animate( {
top: '0px',
opacity: 1
} );
jQuery('h2').fadeIn('slow');
}
return false;
});
While doing this I also have the Title of the current page displayed at the header.php via echo get_the_title(); .
Obviously this function is not updated and my question is: Is there a way to fetch the title of the page loaded via Ajax?

$(the_ajax_response).find('title').text();? – One Trick Pony Sep 7 '11 at 19:55