Skip to content

Instantly share code, notes, and snippets.

@rtanglao
Created August 22, 2010 08:36
Show Gist options
  • Select an option

  • Save rtanglao/543534 to your computer and use it in GitHub Desktop.

Select an option

Save rtanglao/543534 to your computer and use it in GitHub Desktop.
last 5 topics updated in place
<!DOCTYPE html>
<html lang="en">
<body>
<ol>
<div class="d1"></div>
<div class="d2"></div>
<div class="d3"></div>
<div class="d4"></div>
<div class="d5"></div>
</ol>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" ></script>
<script>
(function($){
$.ajaxSetup({
cache: false // turn off AJAX caching so you actually get the top 5!
});
function doIt(){
$.getJSON("http://api.getsatisfaction.com/products/mozilla_thunderbird/topics.json?sort=recently_active&limit=5&callback=?",
function(gsjs){ //gsjs is the JSON object from getsatisfaction
localDate = new Date();
$('.d1').replaceWith("<div class=\"d1\"><p>Last Updated:<b>"+ localDate.toLocaleString() +
"</b></p><li><a href=\""+gsjs.data[0].at_sfn + "\">"+ gsjs.data[0].subject + "</a></li></div>");
$('.d2').replaceWith("<div class=\"d2\"><li><a href=\""+gsjs.data[1].at_sfn + "\">"+ gsjs.data[1].subject + "</a></li></div>");
$('.d3').replaceWith("<div class=\"d3\"><li><a href=\""+gsjs.data[2].at_sfn + "\">"+ gsjs.data[2].subject + "</a></li></div>");
$('.d4').replaceWith("<div class=\"d4\"><li><a href=\""+gsjs.data[3].at_sfn + "\">"+ gsjs.data[3].subject + "</a></li></div>");
$('.d5').replaceWith("<div class=\"d5\"><li><a href=\""+gsjs.data[4].at_sfn + "\">"+ gsjs.data[4].subject + "</a></li></div>");
});
setTimeout(doIt, 32000);
};
setTimeout(doIt, 1000);
})(jQuery);
</script>
</body>
</html>
@rtanglao
Copy link
Author

Oops forgot to mention step 0:
Change mozilla_thunderbird in the file to the Get Satisfaction name of your product e.g. songbird or whatever!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment