Drupal is a registered trademark of Dries Buytaert
drupal 10.6.8 Update released for Drupal core (10.6.8)! drupal 11.3.9 Update released for Drupal core (11.3.9)! drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! linkit 7.0.14 Minor update available for module linkit (7.0.14). migrate_tools 6.1.4 Minor update available for module migrate_tools (6.1.4). diff 2.0.0 Major update available for module diff (2.0.0). masquerade 8.x-2.2 Minor update available for module masquerade (8.x-2.2). video_embed_field 3.1.0 Minor update available for module video_embed_field (3.1.0). bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). colorbox_inline 2.1.1 Minor update available for module colorbox_inline (2.1.1). node_view_permissions 8.x-1.7 Minor update available for module node_view_permissions (8.x-1.7).

ajax_link

68 sites Security covered
View on drupal.org

The ajax link module give tools for themers and developers to easily implements ajax links.

Core implements AjaxResponse methods, but if you already have a page with content you want to append or replace in an area, you have to define custom AjaxResponse to each cases.

This module implements a generic AjaxResponse which load and render page accessible by the link you click on, and only respond with the markup of the array to replace.

Nothing to configure from the UI, everything happens by data attributes on the links, so it's easy to access for themers.

The ajax_link/ajaxLink library needs to be attached on pages where you want to use ajax link.

Example :

I want to load the next page of the product list in the area matching the class products-list.
Define the link as an ajax link adding 'ajax-link' class to the link markup.
Add the 'data-ajax-link-selector' data attribute with css selector where to find and replace content : '.products-list'.
<a href="{{ url }}" class="ajax-link" data-ajax-link-selector=".products-list">This is an ajax link</a>

And in preprocess :

$variables['#attached']['library'][] = 'ajax_link/ajaxLink';

or twig :
{{ attach_library('ajax_link/ajaxLink') }}

Here is available settings for the link :

  • Class :
    • ajax-link : required, Let the module know this link is an ajax link
    • ajax-link-auto : optional, when the link will be 'visible' in the browser, the link will be automatically clicked. With this option, you can have an infinite scroll pager for example.
    • ajax-link-hidden : optional, hide the link. Compatible with ajax-link-auto
  • Data attributes :
    • data-ajax-link-selector: required, define the area to get content and to replace/append.
    • data-ajax-link-method: optional, Define the method to use : replace (default) OR append
    • data-ajax-link-history: optional, Set to 1 if you want the browser history to reflect the clicked link. Default to 0.
    • data-ajax-link-remove-after-execution: optional, remove link after execution. Default to true. Set value to false to keep
      the link displayed and executable.

Activity

Total releases
1
First release
Mar 2026
Latest release
1 month ago
Release cadence
Stability
100% stable

Releases

Version Type Release date
1.0.5 Stable Mar 26, 2026