0

I am getting Jquery is not defined in FireFox browser but works in opera, here is ex http://eef.percipio.me/index/charts.

I load jquery with

if (!window.jQuery) { var jq = document.createElement('script'); jq.type = 'text/javascript'; // Path to jquery.js file, eg. Google hosted version jq.src = 'http://eef.percipio.me/themes/third_party/charts/js/jquery-1.10.2.min.js'; document.getElementsByTagName('head')[0].appendChild(jq); } 

and seems problem with this code, since it works if I do

<script src="http://eef.percipio.me/themes/third_party/charts/js/jquery-1.10.2.min.js" type="text/javascript"> 
5
  • It works fine without Firebug enabled, for me. I can see the chart. But when I enable the firebug its giving error. Do you have the same issue? Commented Jan 8, 2014 at 13:48
  • yes firebug enabled but that is not solution Commented Jan 8, 2014 at 13:51
  • Works fine for me also, I don't see any errors in firebug either Commented Jan 8, 2014 at 13:52
  • Try disabling the Firebug. Commented Jan 8, 2014 at 13:55
  • Check if Firebug has 'Break on all errors' enabled Commented Jan 8, 2014 at 13:55

2 Answers 2

2

Your link is working intermittently for me, even with firebug open. It looks like a timing issue to me, I think you need to make sure jQuery is loaded before trying to use it.

Try googling 'load jquery if not loaded' or take a look at this article - it provides code that should help you.

Also, here is another SO question about a similar issue.

Sign up to request clarification or add additional context in comments.

Comments

1

Works intermittently for me, too. Definitely a timing issue.

You could poll for the availability of jQuery:

function withjQuery ($) { // use $ } function pollForjQuery () { if (window.jQuery) { withjQuery(window.jQuery); } else { // checks for jQuery again in 50ms setTimeout(pollForjQuery, 50); } } // check for jQuery in 0, 50, 100, 150, 200ms etc. pollForjQuery(); 

Reference

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.