Hi,
I am seeing the following error message on chrome console :

'Uncaught ReferenceError: jQuery is not defined'

The relevant html section is :

\x3C/script>") //--> It seems to come from fb_page_alter()/fb.module. Not sure if this is a local setup issue. In that case please close the issue with my apologies. (All other jquery functionality of my site is working fine). Thanks, /jay

Comments

Dave Cohen’s picture

I don't think your description worked. Try using <code> tags.

AFAIK, jQuery should be defined by Drupal. Haven't seen this error myself.

kvhdude’s picture

oops. sorry. here is the html :
thanks,
/jay

  <footer id="footer" role="contentinfo" class="clearfix">
          </footer> <!-- /#footer -->

</div> <!-- /#container -->
  <div id="fb-root"></div>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
  jQuery.extend(Drupal.settings, {"fb":{"base_url":"http:\/\/localhost","ajax_event_url":"http:\/\/localhost\/fb\/ajax","is_anonymous":true,"fb_init_settings":{"xfbml":false,"status":false,"oauth":true,"cookie":true,"channelUrl":"http:\/\/localhost\/fb\/channel"},"test_login_status":true,"get_login_status":true,"controls":"","js_sdk_url":"http:\/\/connect.facebook.net\/en_US\/all.js"}});
Uncaught ReferenceError: jQuery is not defined

if (typeof(FB) == 'undefined') {
  var e = document.createElement('script');
  e.async = true;
  e.src = Drupal.settings.fb.js_sdk_url;
  document.getElementById('fb-root').appendChild(e);
}


//--><!]]>

</script>
</body>
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
window.jQuery || document.write("<script src='/sites/all/modules/jquery_update/replace/jquery/jquery.min.js'>\x3C/script>")
//--><!]]>
</script>

Dave Cohen’s picture

Hmmm... that stuff at the end seems to come from jquery_update module. I think the two modules are not working well together.

To confirm this, could you disable that module and see if the error goes away?

If so, and you still want both modules enabled, I think you need to change the order in which they add code to the bottom of the page. Try setting the module weight of jquery_update to be, say, -20 (that's negative 20). That way it's code which defines jQuery should come first.

kvhdude’s picture

Dave,
Thanks for your response.
The error persists upon disabling jquery update module.

 <!-- /.region -->
      </footer> <!-- /#footer -->

</div> <!-- /#container -->
  <div id="fb-root"></div>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
  jQuery.extend(Drupal.settings, {"fb":{"base_url":"http:\/\/localhost","ajax_event_url":"http:\/\/localhost\/fb\/ajax","is_anonymous":false,"fb_init_settings":{"xfbml":false,"status":false,"oauth":true,"cookie":true,"channelUrl":"http:\/\/localhost\/fb\/channel"},"test_login_status":true,"get_login_status":true,"controls":"","js_sdk_url":"http:\/\/connect.facebook.net\/en_US\/all.js"}});

if (typeof(FB) == 'undefined') {
  var e = document.createElement('script');
  e.async = true;
  e.src = Drupal.settings.fb.js_sdk_url;
  document.getElementById('fb-root').appendChild(e);
}


//--><!]]>

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

/jay

Dave Cohen’s picture

What theme are you using? Try a drupal default theme and see if it works.

I looked at one of my Drupal 7.x sites' source, and I see

<script src="https://work.electricgroups.com/dave/fridge/htdocs/misc/jquery.js?v=1.4.4"></script>
<script src="https://work.electricgroups.com/dave/fridge/htdocs/misc/jquery.once.js?v=1.2"></script>

near the very beginning. Right before drupal.js is included.

Your post shows those lines at the end of the page, below </body>. That's odd.

hanskuiters’s picture

@Dave Cohen: I had the same error (in a custom module). Setting the module weight to a high number did it for me. Thank you for posting

The order of javascript in his page could be caused by copying the code from Firefox. This browser orders the code in a different way.

socialnicheguru’s picture

I am putting certain js scripts in footer and I get this error.

Edit:
how do I change the weight of this code provided by dff? I get the error because this code is executed before js is read.

<script type="text/javascript">
<!--//--><![CDATA[//><!--
  jQuery.extend(Drupal.settings, {"fb":{"base_url":"http:\/\/test.com","ajax_event_url":"http:\/\/test.com\/fb\/ajax","is_anonymous":true,"fb_init_settings":{"xfbml":false,"status":false,"oauth":true,"cookie":true,"channelUrl":"http:\/\/thirdstreetneighbors.dev.socialnicheguru.com\/fb\/channel"},"test_login_status":false,"get_login_status":1,"controls":"","js_sdk_url":"http:\/\/connect.facebook.net\/en_US\/all.js"}});

if (typeof(FB) == 'undefined') {
  var e = document.createElement('script');
  e.async = true;
  e.src = Drupal.settings.fb.js_sdk_url;
  document.getElementById('fb-root').appendChild(e);
}


//--><!]]>

This is no longer relavent:
which fb js file do I have to include in the header to enable this to happen correctly?