request = new Ajax_Request(); $this->request->fill_with_context( $this->request_context ); // Verify nonce check_ajax_referer( 'twofas_light_ajax', 'security' ); // Pass Request to Router $action = $this->router->get_action( $this->request ); // Execute Action $result = $action->handle( $this ); $result->feed_consumer( $this ); } /** * @param $json */ public function consume_json( $json ) { wp_send_json( $json ); } }