Last active
November 26, 2015 10:13
-
-
Save KingScooty/188b0c351d99018bb4a5 to your computer and use it in GitHub Desktop.
Periodically load JSON after initial load and update a chart.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var updateChart = function updateChart () { | |
$.getJSON( "URL.json", function( data ) { | |
// callback for event to take place after JSON has been retrieved. | |
// data is the object containing the JSON. | |
}); | |
}; | |
var init = function init () { | |
updateChart(); | |
}; | |
var cronJob = { | |
interval: 0, | |
createInterval: function() { | |
this.interval = setInterval(updateChart, 500); | |
}, | |
clearInterval: function() { | |
clearInterval(this.interval); | |
} | |
}; | |
init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment