Ajax on the Administration Side of plugin – returns 0

This is because you chose to use a class but did not change the add_action to account:

add_action( 'wp_ajax_nopriv_get_etim', 'get_etim' );

That is not how you hook a class function to an action or filter. So your Javascript is correct, but your handler is not connected to the hook. That is why your AJAX handler fails, incorrect use of add_action.

The solution here is the same as the other questions on the site asking how to hook a class function.

General notes:

  • the use of a class does not improve this code, it is not OO
    • ask yourself, if it’s meant to call get_etim, which get_etim? a class can be turned into an object multiple times, how would it know which one to call? And if you only create/use it once what was the point of the class
  • this is using the old legacy API, you should use the new REST API for AJAX via register_rest_route which avoids lots of pitfalls, and gives you a pretty URL to make requests to
  • The codex is old and was retired several years ago, and can contain out of date information. You should refer to the developer page instead at https://developer.wordpress.org/