Created
January 25, 2017 11:08
-
-
Save martsie/ac005459403304a59e413d3ecfd06fb7 to your computer and use it in GitHub Desktop.
Drupal 7 AJAX commands javascript implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
Drupal.behaviors.my_custom_module = { | |
attach: function(context, settings) { | |
// Use context to ensure the link is only ever activated if it's regenerated. | |
var $mySpecialLink = $('#my-special-link', context); | |
// Only run if the link exists in the current page load or fragment refresh. | |
if ($mySpecialLink.size() > 0) { | |
new Drupal.ajax('#my-special-link', $mySpecialLink, { | |
url: $mySpecialLink.attr('href'), | |
settings: {}, | |
event: 'click tap' | |
}); | |
} | |
} | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment