Dynamic select forms
You shouldn't return fetched array as result, in Drupal ajax the return value from the ajax function actually overwrites the wrapper, so you've got to set $form['vehicle_model']['#options'] with fetched value and the return this piece of form ($form['vehicle_model']) as function return value. so the code will be something like this :

function _ajaxfunction(array $form, FormStateInterface $form_state) {
  $vehicle_make = $form_state-&gt;getValue('vehicle_make');
  $subquery = \Drupal::database()-&gt;select('vehicle_model', 'md');
  $subquery-&gt;join('vehicle_make', 'mak', 'md.make_id = mak.make_id');
  $subquery-&gt;fields('md', ['model_id','model_name']);
  $subquery-&gt;condition('md.make_id', $vehicle_make);
  $results = $subquery-&gt;execute(); $options_models = array();
  foreach ($results as $result) {
    $options_models[$result-&gt;model_id] = $result-&gt;model_name;
  }
  $form['vehicle_model']['#options'] = $options_models;
  return $form['vehicle_model'];
}