AJAX jQuery post frontend returning failed to load resource status 400

There’s two problems that I see.

Firstly, your add_action('wp_ajax_nopriv_get_question',... code is inside your template, but your template is not going to be loaded when the request is sent to wp-admin/admin-ajax.php, which does not load templates. The callback code and the code that hooks it need to go in your theme’s functions.php file.

Secondly, you have only hooked the callback for logged-out users (nopriv_). This means that the code will not work when you are logged in. You need to hook for both logged-in and logged-out users:

add_action('wp_ajax_get_question', 'get_question_from_database');
add_action('wp_ajax_nopriv_get_question', 'get_question_from_database');