2

I'm working on a homepage for a SharePoint workspace right now, and it would be really convenient from an end user and maintenance point of view if I could pull html from summary pages elsewhere on the workspace to display them within the homepage using AJAX.

What would be the best way of aproaching this? Is it even feasible?

Hal Clive
  • 137
  • 1
  • 1
  • 9

1 Answers1

1

It'd be relatively easy. You should use jQuery. I would recommend either restraining all your code to a content editor web part, or if you are looking for a little more aesthetic freedom, then modifying in Sharepoint Designer the homepage's code.

Vap0r
  • 2,588
  • 3
  • 22
  • 35
  • How would I approach it, then? GET the page, strip the relevant information and then append to an element on the homepage? – Hal Clive Nov 23 '11 at 10:59
  • I just saw jQuery's load() function. Holy crap - I love jQuery - it does all that in one line: $('#result').load('ajax/test.html #container'); – Hal Clive Nov 23 '11 at 12:58
  • Haha. Sorry, was sleeping. Looks like you figured it out. But yeah, it's really great. If you have any more questions, just ask them here in the comments, I have quite a bit of experience with Sharepoint and jQuery working together. – Vap0r Nov 23 '11 at 18:06
  • OK, I'm getting 401 unauthorised responses when I send the request to SharePoint. I guess this is some cross-domain policy thing? Is it likely to work when the code is on the same workspace? – Hal Clive Nov 24 '11 at 14:32
  • Well, if the page isn't in sharepoint, you might have some issues. I was assuming your homepage was inside of the sharepoint site? – Vap0r Nov 28 '11 at 07:38
  • I was working offline to build the site but it's on Sharepoint now. Still working out the kinks - Sharepoint loads jQuery 1.3 and I've been working from 1.7 so I'll either have rewrite swathes of code or use the trick on http://stackoverflow.com/questions/528241/how-do-i-run-different-versions-of-jquery-on-the-same-page . Fortunately, it turns out I'm not the poor sod who's responsible for implementing into SharePoint, but I intend to support him as best as I can :) – Hal Clive Nov 28 '11 at 16:49
  • Awesome, glad you were able to find a solution. – Vap0r Nov 28 '11 at 21:57