Skip to content

Instantly share code, notes, and snippets.

@marioangulo
Created June 7, 2017 22:01
Show Gist options
  • Save marioangulo/d94507e5519d60f0b81d903e38f1d6a0 to your computer and use it in GitHub Desktop.
Save marioangulo/d94507e5519d60f0b81d903e38f1d6a0 to your computer and use it in GitHub Desktop.
Drupal Ajax Example
(function($) {
Drupal.behaviors.myModule = {
'attach': function(context) {
$('#edit-field', context).click(function(e) {
$.ajax({
url: 'http://www.example.com',
success: function(data) {
console.log(data);
},
error: function(data) {
console.log(data);
}
});
});
}
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment