how to send Ajax request in wordpress backend

When you enqueue or localize a script you’re doing it specifically for the front end or the admin. If you want to enqueue or localize a script in both, you have to specifically do it for both.

This is used to enqueue/localize for the front end

add_action( 'wp_enqueue_scripts', 'your_function_front' );
your_function_front() {
     wp_localize_script('scripts', 'myAjax', array(
         'root_url' => get_site_url(),
         'ajaxurl'  => admin_url( 'admin-ajax.php' ),
         'nonce'    => wp_create_nonce('wp_rest')
     ));
}

But for the backend you have to also add:

add_action( 'admin_enqueue_scripts', 'your_function_admin' );
your_function_admin() {
     wp_localize_script('scripts', 'myAjax', array(
         'root_url' => get_site_url(),
         'ajaxurl'  => admin_url( 'admin-ajax.php' ),
         'nonce'    => wp_create_nonce('wp_rest')
     ));
}

So if it works in the front end, then you’ve probably done the first one correctly, and you now just have to do it for the back end. Just remember to name your functions to something that’ll make sense in your plugin/theme.