var rename_group = function(old_name, new_name) { tweetonica.api.rename_group(old_name, new_name, function(results) { var tmp = []; for (var g in cache) { var info = cache[g]; if (info.name == old_name) { info.name = results.name; info.rssurl = results.rssurl; } tmp[info.name] = info; } cache = tmp; $('#groups a').each(function() { var o = $(this); if (o.data('groupname') == old_name) { o.data('groupname', new_name); $('span', o).text(display_group_name(new_name, true)); open_group(o); } }); check_for_updates(); }, function(error) { $('#error-description').text('Sorry, we were unable to rename group. Please try again later'); $('#error-dialog').dialog('open'); }); }