I´d suggest you using POST, also signed request to prevent spoofing in this
case (users being able to make fake requests). A simple example, based on
what you wrote:
function loadMyTeams(){
var postdata = {'user_id': owner.getId()}; // assuming that owner exists
after an opensocial call
var params = {};
params[gadgets.io.RequestParameters.POST_DATA] =
gadgets.io.encodeValues(postdata);
params[gadgets.io.RequestParameters.CONTENT_TYPE]
= gadgets.io.ContentType.JSON;
gadgets.io.makeRequest(baseUrl + 'myTeamsJson.php, onLoadMyTeams,
params);
}
... do whatever.
Are you using firebug? It´s a great tool to understand what´s going on in
your requests.
Let me know if it works for you.
Robson Dantas
2010/4/14 Cassio Melo <[email protected]>
> Hello there,
>
> I'm making a GET request to a remote server, but it seems that the
> data doesn't get loaded in time, it returns undefined. It's not a
> problem with the server since it provides the data properly. Try for
> example:
> http://www.inoveinformatica.net/orkut-app/myTeamsJson.php?user_id=08152625651690314134
>
> What's weird is that when I use a preloader:
>
> <Preload href="http://www.inoveinformatica.net/orkut-app/
> myTeamsJson.php?user_id=08152625651690314134"/>
>
> it works, loading the content in data. But I can't use the preloader
> here because I have to pass parameters dinamically. So what should I
> do? What is the problem here? I'm stucked! any help is appreciated..
>
> The request code:
>
> function loadMyTeams(){
> var params = {};
> params[gadgets.io.RequestParameters.CONTENT_TYPE] =
> gadgets.io.ContentType.JSON;
> gadgets.io.makeRequest(baseUrl + 'myTeamsJson.php?user_id=' +
> owner.getId(), onLoadMyTeams, params);
> }
>
>
> function onLoadMyTeams(data){
>
> if (data.data && data.data.length > 0) { // data.data is
> undefined!
>
> globalMyTeams = data.data;
> makeMyTeamsList();
> }
> }
>
> --
> 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]<opensocial-orkut%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/opensocial-orkut?hl=en.
>
>
--
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.