just put a script tag with src attribute in the html for each view that needs it, as below. Beware, that <script src='....' /> doesn't work, must have distinct start end end script tags <script src='....'></script>
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Indivo 0.1" height="400" scrolling="true">
<Require feature="views" />
<Require feature="opensocial-0.8"/>
</ModulePrefs>
<Content type="html" view="profile">
<![CDATA[
<script type="text/javascript" src="http:// your site specific url stuff here /jquery-1.2.6.js"></script>
<p> ......
]]>
</Content>
<Content type="html" view="canvas">
<![CDATA[
<script type="text/javascript" src="http:// your site specific url stuff here /jquery-1.2.6.js"></script>
Ok, I think I've found the answer. Here's what I've done to get jQuery working with my OpenSocial app in Ning:
1. I'm using jQuery from Google, http://code.google.com/apis/ajaxlibs/ , but you could use a copy hosted at your server. This is what I include in the Content element of my specification file:
The functions init and yourFunctionWithjQueryHere are in the file http://example.com/mycode.js, that's where I also have most of the Javascript code related to my application.
I also tried removing the call to google.setOnLoadCallback and just using this inside the init function:
$(document).ready(function() {
// my jQuery code here
});
and my jQuery stuff worked but I was getting an error related to Dojo in Firebug's console so I decided not to go that way. A little weird if, as I think, Dojo is no longer used by Ning. I preferred to stay with Google's recommended way of adding jQuery.
What do you think? Is this the best way of adding jQuery to our OpenSocial apps on Ning?
Wouldn't it be nice if we could just reuse the jQuery already provided by Ning and so we avoid the call to Google or any other external server with jQuery? Why isn't that jQuery, or an updated version version, available to OpenSocial apps in Ning?
Google for "opensocial jquery library" and you will find a specialized library built for use in opensovcial. It works, I use it. Check out my code at www.ozwebspace.com/os/rewards.xml
Because Ning Apps, like all OpenSocial gadgets, run in it's own separate frame space, you can include a standard jquery library as regular and it should run okay.
While this is 100% complete yet, we built a template to display a standard look and feel across social networks, even if the network creator has changed the theme: