-
-
Save kjohnson/ff7e5b45b5d8e9305ae1 to your computer and use it in GitHub Desktop.
CONNECTING THE DOTS WITH WP_AJAX
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
<?php | |
add_action( 'wp_ajax_my_action', 'kbj_my_action' ); | |
function kbj_my_action() { | |
echo json_encode( array( 'message' => 'Message received!' ) ); | |
wp_die(); // this is required to terminate immediately and return a proper response | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment