jQuery cdn not loading in localhost

  • 2 Replies
  • 2474 Views
jQuery cdn not loading in localhost
« on: May 23, 2016, 19:49:06 pm »
I'm trying to load jquery from cdn:

https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js

when i try using jquery i get error '$ is not defined'
why is my jquery not loaded correctly?

*

Oren

  • **
  • 59
Re: jQuery cdn not loading in localhost
« Reply #1 on: May 31, 2016, 00:43:23 am »
Your code is not actually running on localhost, its running on local file system (file://path...)
The protocol is copied with the // link to file://ajax.googleapis.com which doesn't exist.

You need to set up a server on your machine so that you have an actual localhost accessed with the http protocol

Re: jQuery cdn not loading in localhost
« Reply #2 on: January 12, 2018, 13:27:13 pm »
You should set up a server on your computer so that you'd have an actual localhost accessed with the http protocol. It would have other benefits as well since browsers act a bit differently also in other regards when the page is loaded directly from the file system.

 

Sitemap 1 2 3 4 5 6 7 8