-2

I have a script running file while in chrome and safari, but when i try testing it on Internet explorer and Opera i get an undefined error when using '$'.

<head>
<title>test</title>
<script type="text/javascript" src="http:////ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script language="JavaScript">
    $(document).ready(function(){

    });
 </script>
 </head>

Can someone figure out what's wrong with this? I guess it's something to do with the way IE and Opera do things in the background but i have no idea how to go about fixing this.

I've tried moving where i define jquery but nothing. Tried moving all the js to the bottom of the doc as well but nothing.

The script has a lot more code to it for button presses and blur methods but that would take up a lot of space and seeing as teh script falls over on the document ready method i thought it would be a waste but if you feel it should be there please let me know.

ragebunny
  • 1,582
  • 10
  • 33
  • 53

1 Answers1

5

The only thing odd about your code is the URL.

http:////ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js

should be

http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js

or (so you can freely switch between HTTP and HTTPS):

//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js

If that isn't the issue, then it must be in some code you aren't sharing with us.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Should be noted that if you're developing [on windows] locally (e.g. the page you're working on begins with `file:///`) you _must_ supply the protocol (`http://` over `//`). – Brad Christie Oct 11 '13 at 11:14
  • Good point, although `file:///` causes enough problems that I'd strongly advise running a local webserver instead. – Quentin Oct 11 '13 at 11:15
  • I'm running a local server. I was thinking about the URL 'http:////' the other day in fact and forgot to check if it made any difference. Seems to have done the job, thanks for the help. – ragebunny Oct 11 '13 at 11:17