Handle name doesn’t match registered script name in your snippet.
wp_enqueue_script
has ajax-script
and localize has ajax_script
notice the dash and underscore.
You should also follow example from the docs a. register, b. localise, c. enqueue; like so:
<?php
// Register the script
wp_register_script( 'some_handle', 'path/to/myscript.js' );
// Localize the script with new data
$translation_array = array(
'some_string' => __( 'Some string to translate', 'plugin-domain' ),
'a_value' => '10'
);
wp_localize_script( 'some_handle', 'object_name', $translation_array );
// Enqueued script with localized data.
wp_enqueue_script( 'some_handle' );