Created
May 25, 2021 08:59
-
-
Save alokstha1/cc977775b6014ce15beffc7259024753 to your computer and use it in GitHub Desktop.
Get ajax action after ajaxComplete on WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($) { | |
/** | |
* catch AJAX complete events, to catch wordpress actions | |
* @param {jQuery.Event} event | |
* @param {jqXHR} xhr XmlHttpRequest object | |
* @param {Object} settings options for the AJAX request | |
*/ | |
$(document).ajaxComplete(function(event, xhr, settings) { | |
// Specify the AJAX action after which you want to execute your JS | |
if ("data" in settings && settings.data.indexOf("action=your_ajax_action") != -1) { | |
// JS Code that runs after the specified WP action | |
alert(1) | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!