Created
May 5, 2020 13:49
-
-
Save eddiemachado/1f9ede5dac408b72b722b449dc4f7647 to your computer and use it in GitHub Desktop.
JSON Each
This file contains 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
// load up the json file | |
var gameJSON = "https://rainbowsprinkles.com/feud/data/sampleGame.json"; | |
$.getJSON(gameJSON, function (data) { | |
var html = '', | |
listContainer = document.getElementById("ffb-list"); | |
$.each(data, function (key, val) { | |
console.log(data); | |
var i = 0; | |
var j = 1; | |
console.log(val[i].list[1].word); | |
$('#ffb-list').append('<li class="ffb-item"><div class="ffb-item-front"><span class="ffb-item-num">' + j +'</span></div><div class="ffb-item-back"><span class="ffb-word">' + val['' + i + ''].list['' + i + ''].word + '</span> <span class="ffb-item-back-num">' + val['' + i + ''].list['' + i + ''].score + '</span></div></li>'); | |
i++; | |
j++; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment