Skip to content

Instantly share code, notes, and snippets.

@aaronfischer
Created July 8, 2014 15:56
Show Gist options
  • Save aaronfischer/a0a3462d861c76c1b7f1 to your computer and use it in GitHub Desktop.
Save aaronfischer/a0a3462d861c76c1b7f1 to your computer and use it in GitHub Desktop.
Loop through json Object
$.getJSON('URL', function(json, textStatus) {
console.log('successful');
}).done(function(json, textStatus){
console.log('doneful');
console.log('prpl',json);
// loop through and grab the message from each commit
var items = [],
elems = json.states;
console.log(elems);
for (var key in elems) {
var state = elems[key],
option = "<option>" + state + "</option>";
console.log(option);
$('select').append(option);
}
}).fail(function(){
console.log('failed you dummy');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment