Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
268 views
in Technique[技术] by (71.8m points)

cdn - Jquery not working from Google CND

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:/

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...