MySpace Open Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

When my servlet returns a page the opensocial container dies????

Last post 11-16-2008 11:22 AM by Nate. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 11-16-2008 11:22 AM

    • Nate
    • Top 500 Contributor
    • Joined on 09-21-2008
    • Posts 11

    When my servlet returns a page the opensocial container dies????

    Hi People. First off I want to make it known that I am completely new to opensocial, and web development in general.Big Smile

    I am trying to build a simple application that supplies the user with dynamically generated information from a servlet using their displayname. The servlet works and all opensocial script runs fine on the first page, but when the servlet returns the results page the code does not work and no longer is able to access the basic user details. The only information i am trying to gain is the myspace viewer name. My javascript code is below.

    Please help as I am baffled and pretty sure this is not a bug but is due to my own lack of experience.

    Thanks

     /////////////////////////////////////////

    function init()
    {
        var container = opensocial.Container.get();
        var dataRequest = container.newDataRequest();
       
        //Create a request for the viewer's friends
        var friendRequest = dataRequest.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS);
        //Create a request for the viewer name
        var personRequest = dataRequest.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER);
        //Add the requests for processing.
        dataRequest.add(friendRequest);
        dataRequest.add(personRequest);
        //Send the request, passing in a callback.           
        dataRequest.send(responseCallback);
       
    }

    function responseCallback(dataResponse)
    {
        friendsData = dataResponse.get(opensocial.DataRequest.Group.VIEWER_FRIENDS).getData();
        viewer = dataResponse.get(opensocial.DataRequest.PersonId.VIEWER).getData();
        viewerName = viewer.getDisplayName();
        document.getElementById('greet').innerHTML += viewerName;
    }
    init();

    /////////////////////////////////////////

Page 1 of 1 (1 items)