Created
November 7, 2018 15:33
-
-
Save ypsilon-p/60bdb771eebceb75c7ecb1cde962f48e to your computer and use it in GitHub Desktop.
This file contains hidden or 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.post( | |
my_foobar_client.ajaxurl, | |
{ | |
'action': 'foobar', | |
'foobar_id': 123 | |
}, | |
function(response) { | |
console.log('The server responded: ', response); | |
} | |
); |
This file contains hidden or 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 | |
/* | |
Plugin Name: Formscript | |
Description: includes form xyz. | |
Author: Yannik Preiß | |
*/ | |
add_action( 'wp_ajax_foobar', 'my_ajax_foobar_handler' ); | |
function my_ajax_foobar_handler() { | |
// Make your response and echo it. | |
// Don't forget to stop execution afterward. | |
wp_die(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment