To call a shortcode via AJAX in WordPress, first we required a shortcode, so to create a shortcode in wordpress, we are going to use wordpress built-in shortcode API to create shortcode
// Create shortcode
The shortcode API call to register the shortcode handler would look something like this:
add_shortcode( 'get_user_list', 'getUserList');
here "get_user_list" is the name of the shortcode we will use in our ajax call and "getUserList" is the name of function shortcode call automatically whenever we hit the shortcode via ajax.
0 Comment(s)