function requestMe() {
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest(
opensocial.DataRequest.PersonId.VIEWER),
"viewer");
req.send(handleRequestMe);
};
function handleRequestMe(data) {
var viewer = data.get("viewer");
if (viewer.hadError()) {
<em>//Handle error using viewer.getError()...</em>
return;
}
<em>//No error. Do something with viewer.getData()...</em>
}
I have two doubts:
What does that add() do there?
And when I am supposed to write the definition for send() I need to using the argument as callback. Now how do I write code that does a callback to the agrument?