Hi I am creating a orkut app and facing some problem like can't get the viewer gender and its latitude/longitude also its name etc... The message showing in alerts is "undefined" and sometimes showing [object Object].Pls help me and sort out my problem. Thanks in advance.
This is my code in xml file: <?xml version="1.0" encoding="UTF-8" ?> <Module> <ModulePrefs title="YAK - Friends"> <Require feature="opensocial-0.7"/> </ModulePrefs> <Content type="html"> <![CDATA[ <script type="text/javascript"> function request() { var params = {}; params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [opensocial.Person.Field.GENDER]; var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER, params), "viewer"); req.send(response); }; function response(data) { var viewer = data.get("viewer").getData(); var pic = viewer.getField(opensocial.Person.Field.THUMBNAIL_URL); var profile_url = viewer.getField(opensocial.Person.Field.PROFILE_URL); var gender = viewer.getField(opensocial.Person.Field.GENDER); alert(gender); var name = viewer.getField(opensocial.Person.Field.NAME<http://opensocial.person.field.name/> ); alert(name); var dn = viewer.getDisplayName(); alert(dn); var addr = viewer.getField(opensocial.Person.Field.ADDRESSES); alert(addr); var regex = /uid=([^&#]+)/; var result = profile_url.match(regex); if (result.length == 2) { var uid = result[1]; // uid now contains the viewer's orkut UID alert(uid); } else { /* there was a problem getting the UID */ alert('nodata'); } var url = "http://www.example.com/index.php"; var params = {}; params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT; params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST; var postParams = ""; postParams += 'uid=' + uid + '&picture=' + pic; document.getElementById('message').innerHTML = postParams; params[gadgets.io.RequestParameters.POST_DATA] = postParams gadgets.io.makeRequest(url, null, params); }; request(); </script> <div id="message"></div> ]]> </Content> </Module> Best Regards, Pete --~--~---------~--~----~------------~-------~--~----~ 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 opensocial-orkut+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/opensocial-orkut?hl=en -~----------~----~----~----~------~----~------~--~---