Hi Guillaume,
Which container are you trying to install the gadget on? It looks
like you might be trying to use iGoogle, which hasn't switched over to
the new gadgets.* methods. If this is true, you can request access to
the iGoogle sandbox at http://www.google.com/ig/sandbox, where this
code should work.
~Arne
On Jun 15, 10:03 pm, Guillaume <[EMAIL PROTECTED]> wrote:
> Hi Rohit,
>
> Thanks for your reply.
> I tried the code you gave me but I have another problem now.
>
> The error code is:
> gadgets.util has no properties
> gadgets.util.registerOnLoadHandler(makeNormalRequest);
>
> What am I doing wrong.
>
> Thank you for your time reading my post.
>
> Guillaume
>
> On Jun 6, 6:23 pm, "Rohit Ghatol (Google)"
>
> <[EMAIL PROTECTED]> wrote:
> > Hi,
> > Your code is fine, except your makeRequest is being called before the
> > gadget js files have been loaded.
>
> > Instead of calling makeNormalRequest() directly, register it to be
> > called when the gadget framework loads. This is the way to do it
>
> > gadgets.util.registerOnLoadHandler(makeNormalRequest);
>
> > You complete code would look like follows -
>
> > <?xml version="1.0" encoding="UTF-8" ?>
> > <Module>
> > <ModulePrefs title="Fetch Content as Text">
> > <Require feature="opensocial-0.7"/>
> > </ModulePrefs>
> > <Content type="html">
> > <![CDATA[
> > <div id="content_div"></div>
> > <script type="text/javascript">
>
> > function makeNormalRequest() {
> > var params = {};
> > params[gadgets.io.RequestParameters.CONTENT_TYPE] =
> > gadgets.io.ContentType.TEXT;
> > var url = "http://www.google.com";
> > gadgets.io.makeRequest(url, response, params);
> > };
>
> > function response(obj) {
> > //obj.text contains the text of the page that was requested
> > var str = obj.text;
> > var html = str.substr(0,400);
> > document.getElementById('content_div').innerHTML = html;
> > };
>
> > gadgets.util.registerOnLoadHandler(makeNormalRequest);
> > </script>
> > ]]>
> > </Content>
> > </Module>
>
> > On Jun 5, 9:59 pm, Guillaume <[EMAIL PROTECTED]> wrote:
>
> > > Hi all,
>
> > > I am sorry if this question has been already asked. I have search all
> > > over this forum, but couldn't find any help on this issue.
>
> > > I want to create an AJAX call to another server. I have tried using
> > > this example that I have found on:
> > > OpenSocial API developer's guide - Fetching remote
> > > content:http://code.google.com/apis/opensocial/docs/0.7/devguide.html#Remote_...
>
> > > <?xml version="1.0" encoding="UTF-8" ?>
> > > <Module>
> > > <ModulePrefs title="Fetch Content as Text">
> > > <Require feature="opensocial-0.7"/>
> > > </ModulePrefs>
> > > <Content type="html">
> > > <![CDATA[
> > > <div id="content_div"></div>
> > > <script type="text/javascript">
>
> > > function makeNormalRequest() {
> > > var params = {};
> > > params[gadgets.io.RequestParameters.CONTENT_TYPE] =
> > > gadgets.io.ContentType.TEXT;
> > > var url = "http://www.google.com";
> > > gadgets.io.makeRequest(url, response, params);
> > > };
>
> > > function response(obj) {
> > > //obj.text contains the text of the page that was requested
> > > var str = obj.text;
> > > var html = str.substr(0,400);
> > > document.getElementById('content_div').innerHTML = html;
> > > };
>
> > > makeNormalRequest();
> > > </script>
> > > ]]>
> > > </Content>
> > > </Module>
>
> > > But when I try to add this appplication (I have saved the file and
> > > hosted on my server), I have the following errors in my firebug
> > > console:
> > > - gadgets.io has no properties
> > > params[gadgets.io.RequestParameters.CONTENT_TYPE] =
> > > gadgets.io.ContentType.TEXT;
>
> > > I have also tried another example provided by google
> > > at:http://code.google.com/apis/gadgets/docs/remote-content.html#Fetch_text
> > > but still no luck.
>
> > > If any of you can help me, or point me to the right direction, I'd be
> > > very grateful.
>
> > > Best regards,
> > > Guillaume
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"OpenSocial Application Development" 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-api?hl=en
-~----------~----~----~----~------~----~------~--~---