I have a view in Drupal 8 with an exposed form with AJAX enabled. It works fine for admin user, but it doesn't for anonymous users.

I have included in my theme libraries file:

  - core/drupal.ajax

But it's still not working.

  • What does the Ajax call return for anonymous users? You can use your browser's inspect tool / networking tab to see ajax calls from the page and their results. – CG Monroe Jun 25 at 17:15
  • Instead of making an Ajax call, the submit button reloads the page with the view filtered. – jmzea Jun 25 at 18:14
  • Any console errors? I think I've seen this before when other js issues are present – Mrweiner Jun 26 at 1:46
  • No, no errors in the console. – jmzea Jun 26 at 6:21


The problem was that I had a template file for html.html.twig, where the main content was being wrapped in two divs. The problem was that the code

<js-bottom-placeholder token="{{ placeholder_token|raw }}">

was being wrapped too making the AJAX fail, although I don't know why only for users that were not administrators.

Moving this piece of code to the bottom, just before the closing tag for the body, solves it and everything works fine.

Not the answer you're looking for? Browse other questions tagged or ask your own question.