Callback functions are used to handle the inbuilt JavaScript event to handle some stuff.
init
This event will dispatch when Ajax Load more plugin initialize
document.addEventListener("cpt_alm_init", function(e) {
// Fire before init the Ajax Load More..
console.log(e.detail);
});
Before Ajax Call
This event will be fire before call ajax to load more results.
document.addEventListener("cpt_alm_before_loadmore", function(e) {
// Fire before call the Ajax
console.log('Loading results...');
});
After Ajax Call
This event will be fire after successfully ajax.
document.addEventListener("cpt_alm_after_loadmore", function(e) {
// Fire After Ajax Called
console.log('Results loaded!');
});
Error
This event will be fire when ajax failed.
document.addEventListener("cpt_alm_error", function(e) {
// Ajax fails
console.log('Error');
});
Finish
This event will be fire if no more record founds
document.addEventListener("cpt_alm_finish", function(e) {
// Ajax fails
console.log('All records has been listed');
});