I am using the following code but I am unable to retreive the user id.
function userIdrequest() {
var params = {};
params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]
= [opensocial.Person.Field.PROFILE_URL];
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest("VIEWER", params), "viewer");
req.send(userIdresponse);
};
function userIdresponse(data) {
var viewer = data.get("viewer").getData();
var profile_url =
viewer.getField(opensocial.Person.Field.PROFILE_URL);
var regex = /uid=([^&#]+)/;
var result = profile_url.match(regex);
if (result.length == 2) {
var uid = result[1];
return uid;
/* uid now contains the viewer's orkut UID */
} else {
/* there was a problem getting the UID */
}
};
function addMovie(myMovieId,linkId){
var params = {};
var uid = userIdrequest();
var postdata = {
movieId : myMovieId,
userId : uid,
};
params[gadgets.io.RequestParameters.METHOD] =
gadgets.io.MethodType.POST;
params[gadgets.io.RequestParameters.POST_DATA] =
gadgets.io.encodeValues(postdata);
var url = "http://myserver.com/addMovie";
gadgets.io.makeRequest(url, addMovieMsg, params);
}
But I am getting 0 as user id.
Please help me to solve this problem.
Thanq in advance
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Orkut Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/opensocial-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---