I'm building my first iGoogle Gadget in the new Open Social Sandbox
and am having trouble getting a friend's profile from their ID.
I have all of my friends in an ordered list, and want to click an
individual friend and send a request to get that friend's profile,
sending their ID (getID())
My code is:
href="javascript:loadFriend(101671739618776309584);"
function loadFriend(friendId)
{
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonAppDataRequest(friendId), 'friend');
req.send(respondToFriend);
};
function respondToFriend(data)
{
var friend = data.get('friend').getData();
var thumb =
friend.getField(opensocial.Person.Field.THUMBNAIL_URL);
html = new Array();
html.push('<img src="' + thumb + '" />');
_gel('friend_profile').innerHTML = html;
};
But this doesn't work.
The data.get('friend') returns an Object but
data.get('friend').getData() returns null.
I have tried both newFetchPersonAppDataRequest and
newFetchPersonRequest. I've read the documentation and the API states:
"Object newFetchPersonRequest(id, opt_params)
Creates an item to request a profile for the specified person ID. When
processed, returns a Person object."
How do I get the full profile of a Single Friend from their ID? I've
searched everywhere, but all I can find is Lists of friends.
Thanks, Ben
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"OpenSocial Application Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/opensocial-api?hl=en
-~----------~----~----~----~------~----~------~--~---