get db values for external js file

You need to use wp_localize_script() when you enqueue the js script. It’s usually a good alternative of ajax way and this will save you to create multiple js files.

wp_localize_script() can be used to make any data available to your script that you can normally only get from the server side of WordPress.

As you can see on the codex dedicated page

add_action('admin_enqueue_scripts', 'wpse_249089');

function wpse_249089(){
// 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' );
}

Then in the js file, you can use it like that:

<script>
// alerts 'Some string to translate'
alert( object_name.some_string);
// alerts '10'
alert( object_name.a_value);
</script> 

Hope it helps!