1

I haven't worked on building out my site for about 5 or 6 days only to come back to find that Javascript is completely non-functional on my site. As far as I can remember (about 90% positive), everything worked fine last time I worked on it.

Using Firebug, I've found the following error 4 times:

jQuery is not defined
})(jQuery); 

And this error 7 times:

Drupal is not defined
jQuery.extend(Drupal.settings, {"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"capstoneskele","theme_token":"4I-qysgFuZXzCXVlRhgBo6i118JK5s1LLy2-a_ti1lE","js":{"misc\/jquery.js":1,"misc\/jquery.once.js":1,"misc\/drupal.js"......(cont'd)

I've been mostly playing around with a custom theme, so perhaps it's something with one of my tpl.php files - I'm new to Drupal so I really don't know. Any ideas/help would be greatly appreciated as my graduating college is dependent on this project...thanks!

please let me know what further details I can provide also...

1
  1. Check that in html jquery.js and drupal.js correctly open - just click on links in firefox html source view, it's should open js files.
  2. Check your jquery.js and drupal.js in misc folder, if files exists, compare with drupal archive.
  3. Check how many jquery-VERSIONS.js files attached in html, possibly conflicts can be there.
  4. Check your html source for embedded js scripts (viruses like it).
|improve this answer|||||
  • I checked to see if the files exist and it turns out neither one is found; any idea why this might be and/or how to go about fixing it? (Thank you by the way) – Eric T Mar 26 '12 at 22:24
  • Also, I checked in the actual misc folder and the file exists and is in tact, but for some reason I still get: Not Found The requested URL "/misc/jquery.js?v=1.4.4" was not found on this server. – Eric T Mar 26 '12 at 22:32
  • Try copy from source archive these files. I cann't say why these files disappear, first thing is viruses, other hosting issues. – Nikit Mar 27 '12 at 0:36
0

Verify the scripts are being loaded in the correct order: any script that is loaded before jquery will give a 'jquery is not defined' error if it tries to use it.

Just open a page in firebug and inspect the scripts loaded at the bottom of the page; they're loaded in the order in which they appear in the markup.

If this is your problem, then find the places where the troubled scripts are being loaded by drupal (often via add_js()) and try setting a weight parameter. Something like:

drupal_add_js( filename.js, array('weight' => 5));

See: http://drupal.org/node/756722

|improve this answer|||||
  • Another option is to set the js in the 'footer' script section of the template drupal_add_js( filename.js, array('scope'=>'footer')); – doub1ejack Jul 19 '12 at 17:46

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.