Is there a way to append the var url
variable to the address bar without reloading the page. It's my first time using ajax.
Edit: what is the event target node edit 2: got it, much simpler than I thought..
history.pushState(null, null, url);
$('a[href^="/"]').unbind('click').click(function(e){
var url = $(this).attr('href');
e.preventDefault();
$.ajax({
url: url,
success: function( result ){
response = $('<div id="temp-ajax-response-holder" style="display: none;"></div>');
response.html(result);
if (response.find('#ajax').first().find('.header').length > 0 ) $('body').removeClass("home archive").addClass('single');
else if(response.find('#ajax').first().find('.archive_title').length > 0 ) $('body').removeClass("home single").addClass('archive')
else $('body').removeClass("single archive").addClass('home');
if (response.find('#ajax').first().find('.header').length > 0 )
$('body').attr('class', 'single single-post');
$('body #ajax').html(response.find('#ajax').first().html());
bindHTML();
response.html('');
}
});
});