0

I am stuck on a case where I am trying to ajaxify a link, following the tutorial placed here http://clikfocus.com/blog/simple-ajax-example-drupal-6-and-7.

The problem is that the .ajax-processed is not added to the link.

Can you suggest any common pitfalls here?

The weirdest part is that some of the other modules is blocking the functionality. Could it depend on the setting of the view that prints this element?

3

In order to have the AJAX event assigned (and the ajax-processed class added) to a link you need two things:

  1. use-ajax class on the anchor tag
  2. AJAX library loaded

I'm guessing you're missing item #2, and that can be done in a few different ways:

  1. If you're generating a renderable array, use #attached:

    $my_data['#attached']['library'] = array( array('system', 'drupal.ajax') );

  2. Or you could run this PHP pretty much anywhere prior to the page being rendered:

    drupal_add_library('system', 'drupal.ajax');

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.