Skip to content

Instantly share code, notes, and snippets.

@binnyaxel
Created August 17, 2022 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binnyaxel/5f6fc73cc195f2a85471706d8fd96ec4 to your computer and use it in GitHub Desktop.
Save binnyaxel/5f6fc73cc195f2a85471706d8fd96ec4 to your computer and use it in GitHub Desktop.
MyexposedFiltersAjax
(function ($) {
'use strict';
Drupal.behaviors.myexposedfilterajax = {
attach: function (context) {
// On change of the main filter select list.
$('.master-select-list select').change(function (event) {
event.preventDefault();
var selectedCategory = $(this).find(":selected").val();
var endpoint = Drupal.url(mycustom/filter/ajax/' + selectedCategory);
Drupal.ajax({ url: endpoint }).execute();
});
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment