Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmcintosh/93b156eccd73f68364f063bcd2d5165c to your computer and use it in GitHub Desktop.
Save cmcintosh/93b156eccd73f68364f063bcd2d5165c to your computer and use it in GitHub Desktop.
Custom AJAX Command for events
(function($, Drupal) {
/**
* Add new command for reading a event.
*/
Drupal.AjaxCommands.prototype.getEvents = function(ajax, response, status){
// Place content in current-msg div.
$('#event-msg h2').html(response.subject);
$('#event-msg p').html(response.content);
// Remove from unread list.
$('#event-' + response.mid).remove();
// Add events to read list.
$('#event-msgs').append('<li>' + response.subject + '</li>');
}
})(jQuery, Drupal);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment