Created
May 20, 2016 09:00
-
-
Save cmcintosh/93b156eccd73f68364f063bcd2d5165c to your computer and use it in GitHub Desktop.
Custom AJAX Command for events
This file contains 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) { | |
/** | |
* 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