Ajax Multiple Callbacks is not working for first callback? I have been trying to load the data to other select list field from the first select list callback.

I want to change the two select list variables based on the first select list on changes, please refer the below sample code for understanding.

function example_form_alter(&amp;$form, FormStateInterface $form_state) {
     $form['field_example']['widget']['#ajax'] = [
      'callback' =&gt; 'example_ajax_callback',
      'wrapper' =&gt; 'example-company-wrapper',
      'event' =&gt; 'change',
      'progress' =&gt; [
        'type' =&gt; 'throbber',
        'message' =&gt; t(''),
      ],
    ];

function example_ajax_callback(&amp;$form, FormStateInterface $form_state) {
  $first_callback = example_company_form_trigger(&amp;$form, FormStateInterface $form_state);
  $second_callback = example_company2_form_trigger($first_callback, $form_state);
  return $second_callback;
}

function example_company_form_trigger(&amp;$form, FormStateInterface $form_state) {
return $form['field_example1'];
}

function example_company2_form_trigger(&amp;$form, FormStateInterface $form_state) {
return $form['field_company2'];
}


When the ajax callback is calling, the second callback (example_company2_form_trigger ) is only working, the first callback(example_company_form_trigger) is not working.

I am facing this issue while returning the form. 

Could anyone please help me to sort out this issue?
You don't need multiple ajax callbacks, you need multiple ajax commands.

First wrap each form element in a separate div container and then return for each one an ajax command from the same callback:

use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\ReplaceCommand;

...

  function example_ajax_callback(&amp;$form, FormStateInterface $form_state) {
    $response = new AjaxResponse();
    $response-&gt;addCommand(new ReplaceCommand('#example-wrapper1', $form['field_example1']));
    $response-&gt;addCommand(new ReplaceCommand('#example-wrapper2', $form['field_example2']));
    return $response;
  }