0

I have created a custom theme in Drupal. When the code runs on the server jQuery is not being added to the page so I am getting errors such as:

'jQuery' is undefined

I thought jQuery was updated to the page automatically? How can I go about seeing why jQUery has not been added?

Update The code works on my local machine but not the test server.

The two missing files are:

  <script type="text/javascript" src="http://localhost:2013/misc/jquery.js?v=1.4.4"></script>
<script type="text/javascript" src="http://localhost:2013/misc/jquery.once.js?v=1.2"></script>

When I pull the code from the server and restore locally I get the same problem. If I run drush cc all then it starts working again and the script reference appears.

The header section of my contains the following scripts:

<script type="text/javascript" src="http://mysite.com/misc/drupal.js?mqdxrf"></script>
<script type="text/javascript" src="http://mysite.com/misc/jquery.js?mqdxrf"></script>
<script type="text/javascript" src="http://mysite.com/misc/jquery.once.js?mqdxrf"></script>
<script type="text/javascript" src="http://mysite.com/sites/default/files/languages/nl_c9aC92_wtuULa79-hTFcGPM53oqk1yKwciOa_Q3yO28.js?mqdxrf"></script>
<script type="text/javascript" src="http://mysite.com/sites/all/modules/lang_dropdown/msdropdown/jquery.dd.js?mqdxrf"></script>
<script type="text/javascript" src="http://mysite.com/sites/all/modules/lang_dropdown/lang_dropdown.js?mqdxrf"></script>
<script type="text/javascript" src="http://mysite.com/sites/all/modules/devel/devel_krumo_path.js?mqdxrf"></script>
4
  • 1
    Are you outputting $scripts in your version of html.tpl.php? Are you implement hook_js_alter() in your custom theme? Do you have any other custom logic that might affect either the <head> tags or JS in general?
    – Clive
    Commented Jul 18, 2013 at 13:36
  • I have <?php print $scripts; ?> in html.tpl.php. It is working on my local machine but not in test. Very strange... (no to the other two questions)
    – user13134
    Commented Jul 18, 2013 at 13:47
  • 1
    Oh right, if it's working locally, but exactly the same code isn't working on the live server, then there's something wrong with the config on the live server (broadly speaking)
    – Clive
    Commented Jul 18, 2013 at 13:49
  • are you running a browser debugger like chrome developer tools or firebug? if not, do and check your error messages to see if there are any issues being reported browser side in being able to load these files (ex. permission issues).
    – schnippy
    Commented Jul 18, 2013 at 14:20

0

Browse other questions tagged or ask your own question.