ith jQuery and with JavaScript/jQuery coding for Ning?
The jQuery doc page for getJSON is here: http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback…
se a copy hosted at your server. This is what I include in the Content element of my specification file:
<script src="http://www.google.com/jsapi"></script>
<script>
google.load("jquery", "1.3.2");
google.setOnLoadCallback(yourFunctionWithjQueryHere);
</script>
<script>
gadgets.util.registerOnLoadHandler(init);
</script>
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?…
I also reported this to Help Center:
If in "Pages" you write some code requiring jQuery, it doesn't work because the jQuery library it's loaded after Page rendering!
You can test it on every network!
g jQuery in the Analytics textbox is a good way to go. The page would load with the original styles then would rebuild as the jQuery code is run. Might not look very good!…