What would be the best approach in using/including jQuery in Office 365? Should I just use google CDN or is it possible to deploy the jQuery file to the server?
Is there any good articles/resources available on this topic?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
Sandbox mode implies you'll have to do it all at a site level. Personally I'd be going with a CDN link, and additionally I'd be checking to see if it's already been loaded elsewhere in the page - useful in the case of a jquery-dependent webpart which may be included two or three times in a page:
Of course, if the solution you're building is for general release, you'll want to include the files so that it'll still work in secured intranets which don't have a way to hit the CDN - in which case deploy to a library such as the style library (a common target for JQuery)
The most preferred location to add JQuery is the "Site Asserts" library which exists in SharePoint Online - Office 365 site. Quick Steps to create a solution for this
Open elements.xml file and Change the following
Edit Module Name - Add some name "JqueryModule"
Add URL property to Module, something like URL ="Site Asserts"
You have deploy jquery library to document library like style library and refer it from there. You can use CDN too if you prefer to do so.
I posted a blog artlice about adding a jQuery reference to Office365 which is essentially the same as a sandbox solution here http://blog.ianchivers.com/2012/04/add-jquery-to-office365-solutions.html.
Becuase of the restrictions on Sharepoint 2010 Sandboxed solutions it's essential to be able to write functional code client side, as you are very restricted on what you can do on the server.
Here's a cool way of adding jQuery code to Office365 or Sharepoint Online sandboxed solutions.
There's also a post about on how to add a stylesheet to a page from a Sharepoint 2010 sandbox webpart: http://blog.ianchivers.com/2011/11/add-stylesheet-to-page-from-sharepoint.html
You can add jQuery files in Style library through module and access it from style library.