The “Ajax Load More Anything” plugin provides some custom JavaScript triggers that can be used to interact with the loaded content when AJAX requests are successful. These triggers allow you to execute additional actions before and after the content is loaded. Here are the details for each trigger:
ald_ajax_content_ready (Before Load) #
This trigger is fired just before the AJAX content is loaded into the page. It provides an opportunity to execute custom actions or modify the data before it gets implemented into the DOM.
jQuery(document).trigger('ald_ajax_content_ready', [data, args]);
data
: The AJAX response data, which may contain HTML, JSON, or other content.args
: An object containing the arguments passed to the AJAX request.
Example #
// Example of usage:
jQuery(document).on('ald_ajax_content_ready', function(event, data, args) {
// Do something with data
console.log('ald_ajax_content_ready', data, args);
});
ald_ajax_content_loaded (After Loaded) #
This trigger is fired after the AJAX content has been loaded and implemented into the DOM. It allows you to perform additional tasks or apply specific behaviors to the newly loaded content.
jQuery(document).trigger('ald_ajax_content_loaded', data);
data
: The AJAX response data that has been loaded and inserted into the page.
Example #
// Example of usage:
jQuery(document).on('ald_ajax_content_loaded', function(event, data) {
// Do something with data
console.log('ald_ajax_content_loaded', data);
});
ald_ajax_content_success (After Loaded Complete) #
This trigger is fired at the end of the AJAX success callback. It can be used to execute specific actions or routines based on the success of the AJAX request.
jQuery(document).trigger('ald_ajax_content_success', [args]);
args
: An object containing the arguments passed to the AJAX request.
Example #
// Example of usage:
jQuery(document).on('ald_ajax_content_success', function(event, args) {
// Do something with data
console.log('ald_ajax_content_success', args);
});