Created
May 7, 2015 09:46
-
-
Save gaintsev/8f3417a8a85d9cbe02c8 to your computer and use it in GitHub Desktop.
Wordpress Right Way Using 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
//In plugin or functions.php | |
add_action('wp_ajax_my_action_name', 'my_action_name'); | |
add_action('wp_ajax_nopriv_my_action_name', 'my_action_name'); | |
function my_action_name() { | |
// | |
} |
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
var data = { | |
action : 'my_action_name', | |
whatever: ajax_object.we_value | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment