Jquery not working from Google CND

Joe Slater picture Joe Slater · Mar 7, 2013 · Viewed 7.4k times · Source

I just started creating a html file and wanted to use jquery. When I use the jquery from my local machine like this, it works fine.

<script src="jquery.min.js"></script>

But when I try to use this, it does not work

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

I am not able to use any jquery functions when I load the script like this.

What am I doing wrong here?

EDIT: Btw, my html file is on the local machine in drive C:/

Answer

Jack picture Jack · Mar 7, 2013

Your url is incomplete. I believe they leave off the http to show that you can use either http or https, because if you're on a server you don't need it. You only need to add it in if you're running off your file system.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>