Q:

function call with Json-Object, wich contains a function. how to get return variable outside the function?

I use the JFeed Plugin to read information about an RSS-feed in Javascript. You can use this plugin like this:
jQuery.getFeed({
    url: 'rss.xml',
    success: function(feed) {
        alert(feed.title);
    }
});

No i want to make an function, which returns the feed information like this:
function getFeed(feedUrl) {
    message ="Error";

    jQuery.getFeed({
        url: 'http://www.spiegel.de/schlagzeilen/tops/index.rss',
        success: function(feed) {
            message = feed;
        }
    });

    return message;
}

It does not work. How can i get the feed varibale outside the scope of jQuery.getFeed(...) ?

A:

It wont work this way, since method jQuery.getFeed is asynchronous and return will be called earlier.
You need to use callback to get that feeds, like this:
function getFeed(feedUrl, callback){

    message ="Error";

    jQuery.getFeed({
      url: 'http://www.spiegel.de/schlagzeilen/tops/index.rss',
      success: function(feed) {
         callback(feed);
      }
    });
}

getFeed(feedUrl, function(feeds_returned) {
  console.log(feeds_returned);
});

