Skip to content

Instantly share code, notes, and snippets.

@ronipl
Created May 30, 2019 13:47
Show Gist options
  • Save ronipl/1b7b644b57fcc0c72b61dee4ebd7efce to your computer and use it in GitHub Desktop.
Save ronipl/1b7b644b57fcc0c72b61dee4ebd7efce to your computer and use it in GitHub Desktop.
function loadmoreByButton(){
//var moreButon = $('#more').last();
var nextUrl = $('.more').attr("link");
$('body').on('click', '.more', function(){
$.ajax({
url: nextUrl,
type: 'GET',
beforeSend: function() {
$('.more').remove();
}
})
.done(function(data) {
console.log($(data).find('#collection-product-items').html());
$('#collection-product-items').append($(data).find('#collection-product-items').html());
nextUrl = $(data).find('#more').attr("link")
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment