I am trying to override Drupal.ajax.prototype.beforeSend like this:
(function($) { // In mymodule.js, which appears after ajax.js in the page build Drupal.ajax.prototype.beforeSend = function(xmlhttprequest, options) { console.log('overridden!') } })(jQuery);
The file that contains the code is listed below core’s ajax.js in the page’s source, yet it’s the console.log I put inside core’s ajax.js beforeSend that is showing up.
What else is to it? Has anything been changed in Drupal? Using version 9.3. Can’t override any of those functions.