Skip to content

Instantly share code, notes, and snippets.

@mattash
Created March 10, 2011 09:36
Show Gist options
  • Save mattash/863821 to your computer and use it in GitHub Desktop.
Save mattash/863821 to your computer and use it in GitHub Desktop.
A snippet which uses jQuery to load www.oratsouyts.com info on a page.
$.getJSON('http://www.oratsouyts.com/day.js?callback=?', function(data) {
var readings = []
if(data.length > 0) {
$.each(data[0].readings, function(key,val) {
readings.push('<li><a href="http://www.oratsouyts.com/day/'+ data[0].date +'/passage/show/'+data[0].readings[key].passage+'">' + data[0].readings[key].title + '</a></li>');
})
$("<h4 />", {html: "Today is the <strong><a href='http://www.oratsouyts.com/day/"+data[0].date+"'>"+data[0].title+"</a></strong>"}).appendTo("#HomePage_Today");
$("<ul/>", { html: readings.join('') }).appendTo("#HomePage_Today");
} else {
$("<h4 />", {html: "No readings found for today"}).appendTo("#HomePage_Today");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment