public
Last active

John's Iowa Data Call Code

  • Download Gist
datacall.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
var overview;
 
var overview_query_url = "https://www.google.com/fusiontables/api/query?sql=SELECT+PNCommunityType%2C+SUM('NumVoters')%2C+SUM('NumBallotBoxes')%2C+SUM('NumCountedBallotBoxes')%2C+SUM('VoteCount-Paul')%2C+SUM('VoteCount-Bachmann')%2C+SUM('VoteCount-Johnson')%2C+SUM('VoteCount-Gingrich')%2C+SUM('VoteCount-Santorum')%2C+SUM('VoteCount-Huntsman')%2C+SUM('VoteCount-Other')%2C+SUM('VoteCount-Roemer')%2C+SUM('VoteCount-Romney')%2C+SUM('VoteCount-Perry')%2C+SUM('VoteCount-Cain')+FROM+2486515&jsonCallback=?";
 
function refreshData() {
// Hit the Google Fusion Table
$.getJSON(overview_query_url, function(data) {
overview = data;
// Do various things with the JSON data
});
 
// Refresh every 2 minutes (1 min = 60000)
setTimeout( refreshData, 60000 * 2 );
 
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.