views:

10

answers:

0

X post from http://drupal.org/node/953016

The Drupal 7 AJAX system is great, it works very smoothly for forms and even for links.

What I can't work out how to do in a sane way is to call it from javascript. I may want to have a dynamic page without a form and as part of that make a Drupal ajax call, specifically so that the ajax commands get run on return.

The most effective way I have found to do this so far is:

  dummy_link = $('<a href="'+uri+'" class="use-ajax">Loading Vars</a>');
  $(vars_div).append(dummy_link);
  Drupal.attachBehaviors(vars_div);
  dummy_link.click();

Which is effective but a huge hack. I havn't found a way to perform an ajax call and have the Drupal ajax framework do it, rather than the standard jquery framework.

I would have thought that it was possible to invoke the drupal ajax api directly, does anyone know how?