In my portal I need to use "flags" module to create a simil twitter "follow/unfollow". I have installed and configurated this module. All works, via AJAX too.

Now I need to exec some other JS function after that the flag module has completed his call. I think that I need to add (on the backend) some "commands" before flags return "commands" to execute in the frontend.

How I can I do this ?

Thanks, M.

  • drupal.org/project/subscriptions check out this module also, may be what you are trying to implement.
    – Beebee
    Commented Jan 21, 2015 at 22:06
  • Beebee: thanks but in my project I use flags for other things.
    – ZioBudda
    Commented Jan 22, 2015 at 1:44

1 Answer 1


here is API https://www.drupal.org/node/336122

The two events

The flagGlobalAfterLinkUpdate event

This event is triggered immediately after a flag link has been updated. (Flag links appear in two flavors: "Bookmark this!" and "Unbookmark this!", and when we speak of "update" we mean this change in appearance).

The flagGlobalBeforeLinkUpdate event

This event is triggered just before a flag link is updated. As will be explained later, the existence of this event is for cosmetic reasons only: it allows us to carry out actions while the throbber () is still visible.

$(document).bind('flagGlobalAfterLinkUpdate', function(event, data) {
  alert('Object #' + data.contentId + ' (of type ' +
    data.contentType + ') has been ' + data.flagStatus +
    ' using flag "' + data.flagName + '"');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.