Hi everyone,
I've reading many Articles e Materials of OpenSocial and I'm trying to
write simple applications, just to understand the technology, but I'm
not understanding how to do some simple things like:
- Print my Address
- Print my Email
- Print my Sexual_Orientation
- Print my Age
It seems to be simple to do this things but I can't do it.
I'm using the following code:
function loadFriends() {
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');
var params = {};
var params2 = {};
params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
[opensocial.Person.Field.GENDER, opensocial.Person.Field.ABOUT_ME,
opensocial.Person.Field.BOOKS,
opensocial.Person.Field.LANGUAGES_SPOKEN,opensocial.Person.Field.SEXUAL_ORIENTATION];
params2[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]
= [opensocial.Person.Field.AGE];
req.add(req.newFetchPersonRequest('VIEWER', params), 'dinho');
req.add(req.newFetchPersonRequest('VIEWER', params2), 'dinho2');
req.send(onLoadFriends);
}
function onLoadFriends(data) {
var viewer = data.get('viewer').getData();
var dinho = data.get('dinho').getData();
var dinho2 = data.get('dinho2').getData();
html = new Array();
html.push('<ul>');
html.push('<li>' + viewer.getDisplayName() + "</li>");
html.push('<br>' + My Books: '+
dinho.getField(opensocial.Person.Field.BOOKS));
html.push('<br>' + 'Languages: '+
dinho.getField(opensocial.Person.Field.LANGUAGES_SPOKEN));
html.push('<br>' + 'Sexual Orientation: '+
dinho.getField(opensocial.Person.Field.SEXUAL_ORIENTATION));
html.push('<br>' + 'About me: '+
dinho.getField(opensocial.Person.Field.ABOUT_ME));
html.push('<br>' + 'Gender: '+
dinho.getField(opensocial.Person.Field.GENDER).getDisplayValue());
html.push('<br>' + 'Age: '+
dinho2.getField(opensocial.Person.Field.AGE));
html.push('</ul>');
document.getElementById('friends').innerHTML = html.join('');
}
function init() {
loadFriends();
}
On Age and Sexual Orientations, I'm receiveing the message
"undefined", but I edited my profile to put this informations and I
don't know what is happenig.
Any help is important to me.
Thanks for all.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---