Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save eddiemachado/1f9ede5dac408b72b722b449dc4f7647 to your computer and use it in GitHub Desktop.
Save eddiemachado/1f9ede5dac408b72b722b449dc4f7647 to your computer and use it in GitHub Desktop.
JSON Each
// 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