Ajax callback is not working on views exposed filters I am implementing dependent filters in views exposed filter for content:datasource search(Solr search). I have a requirement that in exposed dropdown field when a category is selected, by ajax i need to fetch the sub-categories and show up in another dropdown.For this I tried like below but its not going to callback function only. There is nothing logging in the network console also. Can anyone help me here to resolve.

use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\HtmlCommand;

function module_form_alter(&amp;$form, &amp;$form_state, $form_id) {
$form['field_categories']['#ajax'] = array(
        'callback' =&gt; 'module_get_subcategories',
        // 'callback' =&gt; '::module_get_subcategories',
        'event' =&gt; 'change',
        'wrapper' =&gt; 'edit-field-subcategory',
        'progress' =&gt; array(
          'type' =&gt; 'throbber',
          'message' =&gt; NULL,
        ),
      );
}


function module_get_subcategories(&amp;$form, FormStateInterface $form_state) {
   $response = new AjaxResponse();
   $message = 'test';
   $response-&gt;addCommand(new HtmlCommand('#edit-field-subcategory', $message));
   return $response;
}
Something is weird in the code,
What is that return statement in the last two lines?

For the ajax, try using $form['field_categories']['widget']['#ajax']

Make sure that you have cleared the cache too and that your module is actually called module.