Hi Sajith,
I would direct you to an earlier post which explains the reason why you are
not able to get gender -
http://groups.google.com/group/opensocial-orkut/browse_thread/thread/5404711e5587af44/1b64f824693e039c?hl=en&lnk=gst&q=how+to+retrive+fields+that+are+specified+as+an+opensocial.Enum#1b64f824693e039c

Thanks,
Rohit

Google Developer Programs

Meet OpenSocial developers
irc://irc.freenode.net/opensocial

On Wed, Jun 11, 2008 at 2:00 AM, Sajith S <[EMAIL PROTECTED]> wrote:

>
> I am new to openSocial platform. I have done a sample app to fetch all
> friends of a VIEWER and display their gender. But I am not able to get
> gender. It is always coming null. What is wrong in my code below?
> Please help me.
>
>
> <script>
>        function loadFriends() {
>          var req = opensocial.newDataRequest();
>          var opt_params = {};
>          opt_params[opensocial.DataRequest.PeopleRequestFields.MAX] =
> 500;
>
> opt_params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]
> = [opensocial.Person.Field.GENDER];
>          req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');
>          req.add(req.newFetchPeopleRequest('VIEWER_FRIENDS',
> opt_params), 'viewerFriends');
>          req.send(onLoadFriends);
>        }
>
>        function onLoadFriends(data) {
>          var viewer = data.get('viewer').getData();
>          var viewerFriends = data.get('viewerFriends').getData();
>
>          html = new Array();
>          viewerFriends.each(function(person) {
>            html.push(person.getField(opensocial.Person.Field.GENDER)
> + '<br/>');
>            html.push('<img src="' +
> person.getField(opensocial.Person.Field.THUMBNAIL_URL) + '" title="' +
> person.getDisplayName() + '"/>' + "<br/>");
>          });
>          document.getElementById('friends').innerHTML =
> html.join('');
>        }
>
>        function init() {
>            loadFriends();
>        }
>
>        gadgets.util.registerOnLoadHandler(init);
>        </script>
>
>        <div id='main'>
>            Your friends:
>            <div id='friends'></div>
>        </div>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Orkut Developer Forum" group.
To post to this group, send email to opensocial-orkut@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to