Hi Akash,
what is happening? is it returning a null value for the viewer?
try to use the gadgets.views.getCurrentView() to retrieve the current view :
)
Regards,
Adriano Crestani
On Fri, Jul 25, 2008 at 8:39 AM, Akash Xavier <[EMAIL PROTECTED]>
wrote:
> I used the following code to get the viewer's ID
>
> function request_viewerID() {
> var req = opensocial.newDataRequest();
>
> req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER,
> 'hashKey'));
> req.send(callback);
> };
>
> function callback(obj) {
> var viewer = data.get('hashKey').getData();
> return viewer
> };
>
> viewerID=request_viewerID()
> alert(viewer);
>
> But it doesn't work. Is there anything wrong with the code?
>
> And I also how can I detect which view the app is being run on? (gadget or
> profile or cavas or whatever)?
>
>
> --
> Akash Manohar
> [EMAIL PROTECTED]
>