3 messages in com.googlegroups.google-gadgets-apiRe: Trying to get my blog RSS
FromSent OnAttachments
dejudicibus20 Dec 2006 02:02 
dejudicibus20 Dec 2006 02:13 
Justin McConnell20 Dec 2006 12:10 
Subject:Re: Trying to get my blog RSS
From:Justin McConnell (bool@gmail.com)
Date:12/20/2006 12:10:03 PM
List:com.googlegroups.google-gadgets-api

I think you are running into a Javascript scoping issue. You declare your variables url, showdate, summary and entries using var in the init function. This makes them local to that function only -- when it exits they are destroyed. So in main you end up passing _IG_FetchFeedAsJSON a bunch of undefined variables. You should move those variable declarations from init to main probably. Or if you need to access them in yet still other functions, declare them as global variables by removing the var operator.

On Dec 20, 2:02 am, "dejudicibus" <deju@gmail.com> wrote:

I am trying to get my blog RSS, but when I test it in the scratch pad I get "Bad request issued". Why?

<div id="content_div" style="font-size:80%"></div> <script type="text/javascript"> function init() { var url = "http://syndication.splinder.com/lindipendente/rss2.xml"; var showdate = true; var summary = true; var entries = 6; } function getfeed(feed) { if (feed == null) { return; } var html = ""; html += "<div><strong>" + feed.Title + "</strong></div>"; html += "<div>" + feed.Description + "</div><br>"; if (feed.Entry) { for (var i = 0; i < feed.Entry.length; i++) { html += "<div>" + "<a target='_blank' href='" + feed.Entry[i].Link + "'>" + feed.Entry[i].Title + "</a> "; if (showdate==true) { var milliseconds = (feed.Entry[i].Date) * 1000; var date = new Date(milliseconds); html += date.toLocaleDateString(); html += " "; html += date.toLocaleTimeString(); } if (summary==true) { html += "<br><i>" + feed.Entry[i].Summary + "</i>"; } html += "</div>"; } } _gel("content_div").innerHTML = html; } function main() { init(); _IG_FetchFeedAsJSON(url, getfeed, entries, summary); } _IG_RegisterOnloadHandler(main); </script>