The context value is used internally by the Feeds jsapi. The only real  
way to gain access to is to access the RESTful side of the API  
directly via JSONP methods. In your case, I would suggest doing  
something more like this:

function main(){
  var callback=function(context){
   return function(result){
   if(!result.error){
     console.log('Feed contains '+result.feed.entries.length+' posts');
     console.log('local context is '+context);
    }
   }
  }
  for(var i in urls){
   var feed=new google.feeds.Feed(urls[i]);
   feed.load(callback(i));
  }
}

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
http://jgeerdes.blogspot.com
http://jgeerdes.wordpress.com
[email protected]

Unless otherwise noted, any price quotes contained within this  
communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights  
Wesleyan Church!

And check out my blog, Adventures in Web Development, at 
http://jgeerdes.blogspot.com 
  !


On Mar 26, 2009, at 6:57 AM, klokie wrote:

>
> Hi, I'm loading multiple feeds asynchronously and rendering the
> results in separate elements of the DOM as they are returned from the
> Feeds API. Basically I'm trying to achieve something similar to the
> callback+context behavior mentioned at the end of the section
> http://code.google.com/apis/ajaxfeeds/documentation/#fonje
> but just using the Javascript API.
>
> I noticed that this context index is the first parameter in the call
> to the JSONP function google.feeds.Feed.RawCompletion returned by the
> Feeds API. But instead of just using the internally incrementing value
> I'd like to use my own, so that I can reference it inside of the
> callback function and display the results in the correct places on the
> page.
>
> Here's a simple example, trying to emulate the extra parameter
> mentioned in the docs:
>
> //<![CDATA[
> var urls = { 'digg':"http://www.digg.com/rss/index.xml";,
>       'google':"http://www.google.com/base/feeds/snippets"};
>
> function main() {
>       for (var i in urls) {
>               var feed = new google.feeds.Feed(urls[i]);
>               feed.load( function(result, context){
>                       // callback:
>                       if (!result.error) {
>                               console.log('Feed contains 
> '+result.feed.entries.length + '
> posts');
>                               console.log('local context is ',context); // 
> undefined
>                       }
>               }, i); // pass the strings 'digg', 'google' as trivial 
> "contexts"
>       }
> }
>
> google.load("feeds", "1");
> google.setOnLoadCallback( main );
> //]]>
>
> Can somebody please point me in the right direction?
> thanks
> Klokie
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" 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/Google-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to