I’m trying to run a method from page controller using ajax. Here what I got until now:
On filter.php, I run the hooks:
add_action( 'wp_ajax_addBanco', ['App\PageProprietario', 'addBanco'] );
add_action( 'wp_ajax_nopriv_addBanco', ['App\PageProprietario', 'addBanco'] );
And on the controller, I wil stored the method:
public static function addBanco()
{
wp_send_json_success($_POST);
}
My question is: this is the correct way? The method must be static or could be public?