Use a script that uses JQuery in Drupal
Clément - October 23, 2009 - 20:33
Hello,
I found a site on a script that uses Jquery.
I arrived without problems using a standard html page but I can not use it when I'm in Drupal.
Here is the code that loads the script when it is not used in Drupal:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script src="jquery/gallery.js" type="text/javascript"></script>Apparently Drupal uses Jquery so I could probably delete the first line of code?
That's how I tried (at first) to load the script into Drupal but it does not work (the inner script is loaded but not JQuery)
<?php drupal_add_js('http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', 'external'); ?>
<?php drupal_add_js('site/all/plugins/gallery.js', 'file'); ?>Could you help me please? Thank you in advance!

Drupal 6 ships with jQuery
Drupal 6 ships with jQuery 1.2.6. Use the jquery update module (http://drupal.org/project/jquery_update) to upgrade to 1.3.2.
drupal_add_js is a good way to add javascript to a page, provided that you place this code in the right file and function. An easier way is to add the script in your theme's .info file: http://drupal.org/node/171205#scripts.
Thank you
Thank you very much for the fast response!
I'm going to do the update and also look to integrate the script in my theme as you have advised me.