Skip to content

Instantly share code, notes, and snippets.

@jkeefe
Created January 30, 2012 02:56
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jkeefe/1702188 to your computer and use it in GitHub Desktop.
Save jkeefe/1702188 to your computer and use it in GitHub Desktop.
John's Iowa Data Call Code
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 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment