ajaxify archive generation

This commit is contained in:
Leon Stafford 2016-12-29 17:22:51 +13:00
parent 547e3bf2d6
commit 65c7b8475b
5 changed files with 22 additions and 25 deletions

View file

@ -43,11 +43,13 @@ function myplugin_init() {
}
add_action('plugins_loaded', 'myplugin_init');
add_action( 'wp_ajax_my_action', 'my_action_callback' );
add_action( 'wp_ajax_generate_archive', 'generate_archive' );
function my_action_callback() {
function generate_archive() {
echo 'some response this is!';
$plugin = StaticHtmlOutput::getInstance();
wp_die(); // this is required to terminate immediately and return a proper response
$plugin->genArch();
wp_die();
}