So I'm trying to set up an AJAX action for a plugin I'm building.
When using /wp-admin/admin-ajax.php?action=beacon_podio-get_apps
I was just getting hello world0
and I'm not seeing Request is valid
or the Invalid request
so it seems like the action is not being called
I think I'm missing something but I'm not sure what I'm missing.
class testClass {
public function __construct(){
echo "hello world";
add_action('wp_ajax_beacon_podio-get_apps', array($this, "get_apps"));
}
public function get_apps(){
if(isset($_POST['app_id'])){
$app_id = $_POST['app_id'];
die("Request is valid");
}else{
die("Invalid request");
}
}
}
new testClass();
I have been reading https://codex.wordpress.org/AJAX_in_Plugins but it's missing the URL I'm supposed to be using.