I have a view that gives the users the option to flag nodes. Below this view I need another view listing the results of flagged nodes to show up without the page needing a reload. My skills are limited to Front end development so I'm unsure how I can do this via AJAX.

I did find this module: https://drupal.org/project/jquery_ajax_load

I'm not sure how to implement this module since I need this view to commence upon the first flag event(?)

Would someone be able to help me find a solution?



This is actually a pretty common functionality and there is a module for it, Views Flag Refresh:

Views Flag Refresh allows site administrators to configure which views are refreshed automatically via AJAX when certain flags are selected. This is useful when you have a view that filters by flagged content and you want the view to be refreshed automatically when content is flagged or unflagged elsewhere on the page.

If this doesn't fit your exact needs, there are lots of code snippets in the Flag Javascript API Documentation that might set you in the right direction.

  • Thanks Jim, but I already have Flag Refresh implemented. What I need is for Ajax to load a new view in-page with the results of the flagged contents. Cheers. Mar 27 '14 at 12:03
  • I guess I don't understand your question then as the module I mentioned will reload a View on the page via ajax whenever a flag is clicked on the same page elsewhere.
    – Jimajamma
    Mar 27 '14 at 12:58
  • Sorry Jimma, I mean I need to load a separate view(id2) in the page with the results the moment an item is flagged in view (id1). Mar 27 '14 at 13:46
  • Right. So when you click on a flag link anywhere on the page, this module can reload a View elsewhere on the page. It really doesn't matter if that flag link (or js toggle) is in view id1, this module will see that event and reload view id2...
    – Jimajamma
    Mar 27 '14 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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