Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<%@include file="/libs/foundation/global.jsp"%>
<%@page session="false" %>
<sling:include path="<%= componentContext.getResource().getPath() + ".ajax.html" %>" />
<button id="loadMoreButton" style="width:100%; height:35px">Load More</button>
<script type="text/javascript">
(function($){
var Bestsellerloader = {
queryUrl : "",
init:function(queryUrl){
this.queryUrl = queryUrl;
var self = this;
$("#loadMoreButton").click(function(){
self.load();
$(this).remove();
});
},
load:function(){
$.get(this.queryUrl, {offset: 4, limit: 0}, function(data){
$(".bestsellerloader").append(data);
});
}
}
$(document).ready(function(){
Bestsellerloader.init("<%= componentContext.getResource().getPath() + ".ajax.html" %>");
});
})($CQ);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment