$('.filter_orologi_venduti').click(function(){ var row = 1; var allcount = Number($('#all').val()); var rowperpage = 9; var filtro = this.id; if(row <= allcount){ $.ajax({ url: 'https://www.ccwatchesmc.com/assets/ajax/getmoreorologi.php', type: 'post', data: {row:row,allcount:allcount,rowperpage:rowperpage,filtro:filtro}, beforeSend:function(){ $(".load-more-orologi").text("Caricamento..."); }, success: function(response){ // Setting little delay while displaying new content setTimeout(function () { // appending posts after last post with class="post" //$(".immagine-album:last").after(response).show().fadeIn(); console.log("reload 1"); //$(".portfolio-wrapper").isotope('appended',response); var dati = JSON.parse(response); var html = ''; $.each(dati.contenuto, function (key, value) { html += '
  • '; html += ''; html += '
    '; html += '
    '; html += ''; html += '
    '; html += ''; if(value.titolo_immagine_it != null){ html += '
    '+value.titolo_immagine_it+'
    '; } html += '
    '; html += '
    '; html += '
    '; html += '
    '; html += '
  • '; }); $('#'+filtro).css("text-decoration", "underline"); $('#filtro').val(filtro); $("#all").val(dati.tot); $("#row").val(1); newItems = $(html).appendTo('.grid-orologi-venduti'); var $isoContainer = $('.grid-orologi-venduti'); $isoContainer.isotope('remove', $isoContainer.isotope('getItemElements')); $isoContainer.isotope('layout'); $isoContainer.isotope('appended', newItems); var rowno = 1 + rowperpage; // checking row value is greater than allcount or not if (rowno > parseInt(dati.tot)) { // Change the text and background $('.load-more-orologi').hide(); //$('.load-more').css("background","darkorchid"); } else { $('.load-more-orologi').show(); $(".load-more-orologi").text("