You’ve used incorrect names for the hook. As documented here, the hook name should be wp_ajax_
followed by the action
parameter that you’re sending in the request. In your example that’s data_fetch
, so:
add_action('wp_ajax_my_action' , 'data_fetch');
add_action('wp_ajax_nopriv_my_action','data_fetch');
Should be:
add_action( 'wp_ajax_data_fetch', 'data_fetch' );
add_action( 'wp_ajax_nopriv_data_fetch', 'data_fetch' );