Jump to content

error connecting to googles cdn‏


nini3008

Recommended Posts

hi guys, please i need your help in figuring out why my machine isn't loading googles cdn. i suspect its a path issue but i am unable to detect what is actually wrong.

 

here is my code snippet

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>getting jquery</title>

<script type="text/javascript" src= "//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"> </script>

<script type="text/javascript">

google.load("jquery", "1.8.1");

google.setOnLoadCallback(function()

{

console.log($('#title').text());

});

</script>

</head>

<body>

<h1 id="title">Getting jquery</h1>

</body>

</html>

 

 

but i get an error saying : "ReferenceError: google is not defined" in my console log.

 

any help would be appreciated

 

 

thanks

Link to comment
Share on other sites

Well, you definitely do need to include the http, but I'm a little confused... the link you are linking to is the jQuery file -- you shouldn't need to do any google.load(). Are you following any specific tutorial?

 

 

yes i am following the 'complete web programmer' purchased from killerphp. the original link shown in the tutorial referred to use --> src = "http://ajax.googleapis.com/jsapi" but that isnt working either.

 

i could easily insert my downloaded jquery file in the 'src' and my script would work fine but as adviced in the tutorial, its best to use google cdn to access jquery and im finding it impossible to get it to work.

Link to comment
Share on other sites

As far as I understand it, Google's CDN has changed since that tutorial was written (I'm actually in the process of redoing some of the jquery videos). As far as I understand it, Google's CDN just uses a direct link to the javascript file now. See https://developers.google.com/speed/libraries/devguide#jquery

 

you are right, i figured it was not current. i did see this link already but for some reason it isn't connecting. thanks for your replies though...really appreciate them.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...