TestProject Forum

General => General Questions => Topic started by: Alex on May 23, 2016, 19:49:06 pm

Title: jQuery cdn not loading in localhost
Post by: Alex 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?
Title: Re: jQuery cdn not loading in localhost
Post by: Oren 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
Title: Re: jQuery cdn not loading in localhost
Post by: jackar56 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.