Hi Frisoni,
ya i am calling the req.send after the add and i made the change as
you told.
---------------------------------------------------------------------------------------------------------------------------------------------------
req.send(function getIds(response)
{
var viewer = response.get('viewer').getData();
if (viewer === null)
{
}
else
{
var profile_url =
viewer.getField(opensocial.Person.Field.PROFILE_URL);
var regex = /uid=([^&#]+)/;
var result = profile_url.match(regex);
visit_id = viewer.getId();
visit_name = viewer.getDisplayName();
if (result.length == 2)
{
var uid = result[1];
stored_uid = uid;
}
else
{
alert('There seems to be an error');
}
}
onLoadFavorites();
onLoadRecos();
});
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Even after changing to the aboce code. Both the function
onLoadFavorites and onLoadRecos show visit_id as undefined but if the
user adds the application its fine.
heres the url if you want to try
http://sandbox.orkut.com/Application.aspx?appId=535756404836&uid=17158969329579561372
- Sambi
On Aug 11, 8:00 pm, Frisoni <
fris...@gmail.com> wrote:
> Hi Sambi,
>
> your code is OK. Are you calling req.send after red.add?
> Take care if you pass a function in req.send it will be executed
> assyncronous, so if you do like this:
> function callback_function(data) {
> viewer = data.get... blablabla}
>
> req.send(callback_function);
> alert(viewer.getDisplayName); // At this point, callback function may not
> yet be completed, so viewer is still Null.
>
> You can try this code, a just checked it in Dafos:
http://www.orkut.com.br/Main#AppInfo.aspx?appId=845795770537
> var params = {};
> params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [
> opensocial.Person.Field.PROFILE_URL,
>
opensocial.Person.Field.ID
> ];
>
> var req = opensocial.newDataRequest();
> req.add(req.newFetchPersonRequest('VIEWER', params), 'viewer');
> req.send(function get_callback(response) {
> viewer = response.get("viewer").getData();
> output(viewer.getField(opensocial.Person.Field.PROFILE_URL));
> output(viewer.getField(
opensocial.Person.Field.ID));
> });
>
> Hope can help you,
> Frisoni
>
> On Mon, Aug 11, 2008 at 21:42, Fernando chucre <
fernandochu...@gmail.com>wrote:
>
> > try
>
> > var params = {};
> > params[opensocial.DataRequest.
> > *PeopleRequestFields.PROFILE_**DETAILS]
> > = [
opensocial.Person.Field.ID];*
>
> > var req = opensocial.newDataRequest();
> > req.add(req.newFetchPersonRequest('VIEWER', params),
> > 'viewer');
>
> > 2008/8/11 Sambi Reddy <
bsambire...@gmail.com>