I 'm trying to build a social networking application for Orkut based
on the tutorial at
http://code.google.com/apis/orkut/articles/tutorial/tutorial.html
but the code for loading friends doesn't work.
The code is:
<script type="text/javascript">
function loadFriends() {
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest
(opensocial.IdSpec.PersonId.VIEWER), 'viewer');
var viewerFriends =
opensocial.newIdSpec({ "userId" : "VIEWER",
"groupId" : "FRIENDS" });
var opt_params = {};
opt_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 100;
req.add(req.newFetchPeopleRequest(viewerFriends,
opt_params), 'viewerFriends');
req.send(onLoadFriends);
}
function onLoadFriends(data) {
var viewer = data.get('viewer').getData();
var viewerFriends = data.get('viewerFriends').getData();
html = new Array();
html.push('<ul>');
viewerFriends.each(function(person) {
if (person.getId()) {
html.push('<li>', person.getDisplayName(), '</li>');
}
});
html.push('</ul>');
document.getElementById('friends').innerHTML = html.join
('');
gadgets.window.adjustHeight();
}
function init() {
loadFriends();
}
gadgets.util.registerOnLoadHandler(init);
</script>
There are no results displayed....
Can you please give me a solution...
I'm trying to find the error since Monday.
Thanks,
Simos
--
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.