There is a JSON file called json.json
in the directory. It contains the same data as the var json
shown below, but for some reason it is not working when attempting to pull from the URL also saved in the same directory.
<script>
//var json = '{"Id": "0001","Type": "Type","Theme": "Default","Auto": "True","Countdown": 600,"Timer": 480000,"Max": 5,"List":{ "Names":[{"Name":"Name 9", "Account": "1009", "IsWinner":"False"},{"Name":"Name 10", "Account": "1010", "IsWinner":"False"},{"Name":"Name 11", "Account": "1011", "IsWinner":"False"},{"Name":"Name 12", "Account": "1012", "IsWinner":"False"},{"Name":"Name 13", "Account": "1013", "IsWinner":"False"},{"Name":"Name 14", "Account": "1014", "IsWinner":"False"},{"Name":"Name 15", "Account": "1015", "IsWinner":"False"}]}';
var json = 'json.json'
obj = JSON && JSON.parse(json) || $.parseJSON(json);
var seconds = obj.Countdown;
function secondPassed() {
var minutes = Math.round((seconds - 30)/60);
var remainingSeconds = seconds % 60;
if (remainingSeconds < 10) {
remainingSeconds = "0" + remainingSeconds;
}
document.getElementById('feed').innerHTML = minutes + ":" + remainingSeconds;
if (seconds == 0) {
clearInterval(countdownTimer);
document.getElementById('feed').innerHTML = "00:00";
} else {
seconds--;
}
}
var countdownTimer = setInterval('secondPassed()', 1000);
</script>