try _IG_RegisterOnloadHandler(makeNormalRequest) instead of gadgets.util.registerOnLoadHandler(makeNormalRequest) _IG_RegisterOnloadHandler() works fine for me on Orkut,hi5.Thanks ~@@[EMAIL PROTECTED] http://aakash-bapna.blogspot.com
> Date: Sun, 15 Jun 2008 04:37:58 -0700> Subject: [OpenSocial] Re: Fetching > External Content - Text> From: [EMAIL PROTECTED]> To: > [email protected]> > > Hi> > I tried your example as well and > am now getting an error saying> "gadgets.util has no properties. I tried > Require'ing opensocial-0.8> with the same result.> > Thanks a lot.> > On Jun > 6, 6:23 am, "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> _________________________________________________________________ Now you can invite friends from Facebook and other groups to join you on Windows Live⢠Messenger. Add now. https://www.invite2messenger.net/im/?source=TXT_EML_WLH_AddNow_Now --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
