(414) 529-9900

8800 South 102nd Street • Franklin, WI 53132

Top Contributors



Hello World Tutorial

Hello World Tutorial
Here's the sample code:

<?xml version="1.0" encoding="UTF-8" ?>
  <ModulePrefs title="List Friends Example">
    <Require feature="opensocial-0.8"/>
  <Content type="html">
    <script type="text/javascript">
       * Request the OWNER and OWNER's friends.
      function request() {
        var idspec = opensocial.newIdSpec({ "userId" : "OWNER", "groupId" : "FRIENDS" });
        var req = opensocial.newDataRequest();
        req.add(req.newFetchPersonRequest("OWNER"), "get_owner");
        req.add(req.newFetchPeopleRequest(idspec), "get_friends");

       * Parses the response and generates html to list the names of the owner and
       * his or her friends.
       * @param {Object} dataResponse Friend information that was requested.
      function response(dataResponse) {
        var owner = dataResponse.get('get_owner').getData();      
        var friends = dataResponse.get('get_friends').getData();
        var html = 'Friends of ' + owner.getDisplayName();
        html += ':<br><ul>';
        friends.each(function(person) {
          html += '<li>' + person.getDisplayName() + '</li>';
        html += '</ul>';
        document.getElementById('message').innerHTML = html;

      // Execute the request function when the application is finished loading.

    <div id="message"> </div>

1) gadgets.util.registerOnLoadHandler(request);
here you can replace "request" with the javascript function that will be executed once the file is loaded.

2) now let's examing the function request()

3) var req = opensocial.newDataRequest();
first you've created a request object via opensocial.newDataRequest() - all requests will be added to this object and sent all at once (we'll see how)

4) req.add(REQUEST, NAME);
this is how we add a new request to the request object.
req.newFetchPersonRequest("OWNER") data fetch request (for the owner of this profile)
get_owner, the name of this piece of data, that's how we will call it in the next steps

5) finally req.send(response)
this function sends all the requests to our server in batch mode. the only parameter defines the function that will handle the response of our server

6) function response(dataResponse)
handles the response of our server, dataRespons keeps the data, it will be used within this function to reach the response of our server.

7) var owner = dataResponse.get('get_owner').getData();      
dataResponse.get('get_owner') note that dataResponse was the response of our server, and get_owner is the name that we defined in the "request" function, so in other words, this specifies what part of the data this variable (owner in this case) will hold. and getData() is used to transform the data in JSON format into human readable string.

from this point on, you can play with the data however you like, you're limited with the possibilities of the OpenSocial


I am a member of almost all the group because I like so much,Until I am Member chip by grou.ps why can I not in the in the new site (join) why, why, why come amtwort giben could please, please, please greeting Carlos Andres(CAPN1989@web.de)
ayuda por favor no puedo borrar ni editar nada en mi pagina de inicio.esta es mi page http://grou.ps/turinconsito/home
ayuda por favor no puedo borrar ni editar nada en mi pagina de inicio.esta es mi page http://grou.ps/turinconsito/home
I say we all go to social p a r o d y or maybe file a class action lawsuit against grou.ps for breach of contract and maybe a restraining order to temporarily allow us to get our stuff off of this site
very nice information, i would surely come again, thanks