You use the jQuery method load()to insert content, which is a shortcut to $.ajax, which of course dynamically inserts the content.
Dynamic content requires event delegation to a non-dynamic parent, something jQuery simplifies with on()
jQuery(function($) {
$('#content').on('click', '#pagination a', function(e){
e.preventDefault();
var link = $(this).attr('href');
$('#content').fadeOut(500, function(){
$(this).load(link + ' #content', function() {
$(this).fadeIn(500);
});
});
});
});
source
share