Allow alternative URL for use-ajax links using data attribute

Created on 12 December 2016, over 8 years ago
Updated 9 July 2025, 4 days ago

Problem/Motivation

For progressive enhancement, using an alternative URL for AJAX links (enabled via use-ajax classes) is really useful. Swapping nojs for ajax is supported, but isn't very flexible and requires URLs to include nojs.

Proposed resolution

Enhance the ajax.js support for use-ajax classes by preferring an alternative URL (if present) for AJAX requests. This can be provided by a data attribute, e.g. data-ajax-url.

API changes

Addition of a feature with no changes to existing usage.

Feature request
Status

Needs work

Version

11.0 🔥

Component

ajax system

Created by

🇬🇧United Kingdom andrewbelcher

Live updates comments and jobs are added and updated live.
  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • @andrewbelcher opened merge request.
Production build 0.71.5 2024