Ajax pagination works only first and third time

@kennypu in stackoverflow saved my life with this:

t’s because you’re changing the contents of #paginar, so what happens is the event on the links are getting cleared. depending on your jquery version, you can either use .live() or add the even to the #pagi-container instead:

$('#pagi-container').on('click','#paginar > a',function() {... }

my finished code is like this:

  $('#pagi-container').on('click','#paginar > a',function(e) {
        e.preventDefault();
        var link = jQuery(this).attr('href');
        $('#portfolio-thumbs').html('Aguarde, por favor...');
        $('#portfolio-thumbs').load(link+' #portfolio-destaque');
        $('#pagi-container').load(link+' #paginar');

    });

thanks kennypu!