send meta box input data without publish button

You can get the post id like this

var post_id = $('input[name="post_ID"]').val();

See this full working code. BTW its only save the value to the meta in the ajax it won’t save it on the publish button you need to add another hook with another function. you can’t use the same function that you used in the ajax because the die()

add_action( 'add_meta_boxes', 'rt_book_sales' );
add_action( 'wp_ajax_rt_book_name_rander', 'rt_book_name_rander' );
function rt_book_sales(){
    add_meta_box( 'rt_bk_goal', 'Meta Box Title', 'rt_books_meta_rander', 'post', 'normal', 'high' );
}

function rt_books_meta_rander($post){
?>
</div class= "wrap">
   <input type="text" name="book_name" id="book_name" value="<?php echo esc_attr(get_post_meta( $post->ID, 'rt_book', true )); ?>">
   <input type="submit" class="rt_bk_btn">
</div>
<?php
}

add_action('admin_footer', 'my_admin_add_js');
function my_admin_add_js() {
    ?>
    <script>
        jQuery(document).ready(function($) {
            $(document).on('click', '.rt_bk_btn', function(e) {
                e.preventDefault();
                var bk_name = $('#book_name').val();
                var post_id = $('input[name="post_ID"]').val();
                var data = {
                    'post_id': post_id,
                    'bk_name': bk_name,
                    'action': 'rt_book_name_rander',
                }
                $.post(ajaxurl, data, function(resp){
                    console.log(resp);
                });
            });
        });
    </script>
    <?php
}

function rt_book_name_rander(){
    if (isset($_POST['bk_name']) && isset($_POST['post_id'])) {
        $bk_name = $_POST['bk_name'];
        update_post_meta( $_POST['post_id'], 'rt_book', $bk_name );
    }

    die();
}