9 messages in com.googlegroups.google-gadgets-apiRe: _IG_FetchContent vs. _sendx
FromSent OnAttachments
Bonstio23 Apr 2007 04:51 
Bonstio23 Apr 2007 05:17 
Bonstio23 Apr 2007 13:47 
Dann (Google Employee)27 Apr 2007 15:02 
Bonstio28 Apr 2007 05:03 
Bonstio29 Apr 2007 06:40 
Bonstio03 May 2007 14:20 
Dann (Google Employee)04 May 2007 15:12 
Bonstio05 May 2007 05:22 
Subject:Re: _IG_FetchContent vs. _sendx
From:Dann (Google Employee) (d.@google.com)
Date:04/27/2007 03:02:05 PM
List:com.googlegroups.google-gadgets-api

Hey Bonstio,

_sendx() is an undocumented method that sends out asynchronous requests based on the relative URL passed in. So there's naturally going to be some confusion over its use. Needless to say, but I'd recommend sticking with documented methods such as _IG_FetchContent() because the API is guaranteed to support it. By using _sendx(), you're depending on a method that we may change down the road which will inadvertently break your gadget.

Based on the FetchContent request you pasted, it looks like your URL parameters are not properly escaped. When the URL you're fetching from contains URL parameters in the querystring, you must escape all values that contain non-alphanumeric characters.

For example here's how to correctly construct the URL from your previous post:

var url = "http://www.google.com/trends?" + "q=" + _esc("monte carlo tennis gary halbert on the beach") + "&geo=" + _esc("all") + "&date=" + _esc("all"); _IG_FetchContent(url, function(response) { alert(response); });

Try this, and let me know if this works.

Thanks, Dann

On Apr 23, 1:47 pm, Bonstio <bons@gmail.com> wrote:

OK I have spent some time searching this very group and I think I see what's happening...

I've found a loads of unanswered questions about chaining together multiple nested _IG_FetchContent's. No official word that I can find but a lot of people reporting problems with it. So what's the deal?

Now I can see that in fact both _IG_FetchContent and _sendx are still stripping quote marks and hashes (and other things maybe?) from the response which I am also puzzling over I really don't want to write a dirty hack to re-insert these things :-(

On Apr 23, 1:17 pm, Bonstio <bons@gmail.com> wrote:

Firebug shows me that the _IG_FetchContent request looks like this:

and entering this in the browser manually really does show simply and blank page. What is going on?

On Apr 23, 12:51 pm, Bonstio <bons@gmail.com> wrote:

Hi

I am writing a gadget which bring together functionality from the Search History Trends gadget and the Google Trends gadget and am having problems getting back data from remote servers. So I really have two questions...

First problem is to do with which function to use. I originally used the _sendx function to retrieve data as this is what's used in the Search History trends gadget. This works wll but seems to strip characters from the response. This affects lots of things but the biggest problem is the fact that color="#ffff00" becomes color=ffff00' which breaks. Why does this happen? The line of code which fetches the page looks like this:

_sendx(GST__MODULE_ID__.trendsRequest("http://www.google.com/trends? q=test%2C+tester", function(response){.....})

Then I tried using the API supported function _IG_FetchContent instead of _sendx - but this returns an empty response. No errors, just an empty response. Why is this happening?

The URL of the affected gadget
ishttp://webstickiesmod.googlecode.com/svn/trunk/smh.xml the problems occur in renderTrends which is called when you click on the trends tab. The gadget specifies render_inline="required" btw.