How to call jQuery in the Google Gadgets API

Simple code like this will never work, and I searched all of Google, the damn company doesn't provide a simple tutorial on how to apply jQuery? This is very frustrating!

<Content type="html"><![CDATA[ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script> <div id="content_div" height="250">abc</div> <script type="text/javascript"> alert($('#content_div').css('height')); </script> ]]> </Content> 

What's wrong?

========

If I use this:

 <script type="text/javascript" src="https://www.google.com/jsapi"></script> 

I will get this error:

enter image description here

If I use this:

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

I will get this error:

enter image description here

Error message:

 [blocked] The page at https://pct0pnegjcnktlrmc1cf6dh916jdefnq-a-sites-opensocial.googleuserconte…y%252F8t2ynycEfP2AdZ8IeBvJF%26c%3Denterprise&rpctoken=-2403247092253746774 ran insecure content from http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js. 
+4
source share
1 answer

Well, after I read this https://developers.google.com/speed/libraries/devguide , I finally solved this damn question ...

Instead

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

It should be: (the culprit is " http ")

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

So this is how it will look:

 <Content type="html"><![CDATA[ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <div id="content_div" height="250px">abc</div> <script type="text/javascript"> $('#content_div').html('123'); </script> ]]> </Content> 
+3
source

All Articles