views:

42

answers:

0

I want to display the viewer's name in my application. But something is going wrong and the name is not displayed... the code is as follows:

<?xmlversion="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="TesterFris - Show Name">
   <Require feature="opensocial-0.8" />
   <Require feature="dynamic-height" />
</ModulePrefs>
<Content type="html">
  <![CDATA[
  <script type="text/javascript">

    function showOwnName() {

      var name = opensocial.newIdSpec({ "userId" : "OWNER", "groupId" : "FRIENDS" });      
      var req = opensocial.newDataRequest();
      req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER), 'owner');

      req.send(onLoad_DispName);
    }

    function onLoad_DispName(data) {
      var owners = data.get('owner').getData();
      var html = owners.getDisplayName();

      document.getElementById('name').innerHTML = html;
      }


    gadgets.util.registerOnLoadHandler(showOwnName);  
    </script>
<div title="hi">
Hello, 
</div>
<div title="name"> </div>
]]></Content>
</Module>

I cant understand where i am going wrong...