Hi, I am doing one application were I need the friends info, the below
code is not working.
it's not showing friends information. How it will work?
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Search-Friends-Alert2">
<Require feature="opensocial-0.7"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<div id="message">Searching-Friends... </div>
<script type="text/javascript">
/**
* Request for friend information.
*/
function getData() {
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER),
'viewer');
req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS),
'viewerFriends');
req.send(onLoadFriends);
};
/**
* Parses the response to the friend information request and
generates
* html to list the friends along with their display name.
*
* @param {Object} dataResponse Friend information that was
requested.
*/
function onLoadFriends(dataResponse) {
var viewer = dataResponse.get('viewer').getData();
var html = 'Friends of ' + viewer.getDisplayName();
html += ':<br><ul>';
var viewerFriends = dataResponse.get('viewerFriends').getData();
viewerFriends.each(function(person) {
html += '<li>' + person.getDisplayName() + '</li>';
});
html += '</ul>';
alert("Friends:"+html);
document.getElementById('message').innerHTML = html;
};
</script>
<script type="text/javascript">
gadgets.util.registerOnLoadHandler(getData);
</script>
]]>
</Content>
</Module>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Orkut Developer Forum" 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-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---