-
-
Save delias/b3b9c9543eb27a2df078de0346f7554d to your computer and use it in GitHub Desktop.
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
function my_enqueue_assets() { | |
wp_enqueue_script( 'ajax-function', get_stylesheet_directory_uri() . '/js/ajax-function.js', array(), '1.0.0', true ); | |
wp_localize_script( 'ajax-function', 'ajaxfunction', array( | |
'ajaxurl' => admin_url( 'admin-ajax.php' ) | |
)); | |
} | |
my_enqueue_assets(); | |
add_action('wp_ajax_get_chaplains', 'get_chaplains_callback'); | |
add_action('wp_ajax_nopriv_get_chaplains', 'get_chaplains_callback'); | |
function get_chaplains_callback(){ | |
echo json_encode($result); | |
wp_die(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment