0
votes

I create a content type in Drupal that contains the fields to add the title and body of a News. I also created a view that will display a list of just the title of the first 5 news items and I like to display the News body in an empty <div> that will show using jQuery.

I'm not sure how to call or pass the variables from the view to jQuery. I tried the rewrite results but the code gets striped and I'm not sure how to accomplish this task.

How can I do it?

1

1 Answers

0
votes

I assume that you could add your jQuery script in your template.php like explained here.

Here is an example found on that topic:

function mytheme_preprocess_page(&$vars, $hook) {
  if (true) { // test your content-type view here
    drupal_add_js(drupal_get_path('theme', 'mytheme') . '/mytheme.js');
    $vars['scripts'] = drupal_get_js();
  }
}