> Does this has something to do with my functions being inside classes?

It seemed to me that the problem lies here, in `myplugin_ajax_script.js`: `action: 'myplugin_ajax_function'` — shouldn't the AJAX **action** be `myplugin_ajax_script`?

Because in `Myplugin::define_admin_hooks()`, that's the action you registered. And shouldn't that line, which registers the action, look like so:

```php
$this->loader->add_action( 'wp_ajax_myplugin_ajax_script', 'wp_ajax', // wrapped for brevity
	array( $plugin_admin, 'myplugin_ajax_function' ) );
```

Because I don't see where you defined a global PHP function named `myplugin_ajax_script`.