Created
March 7, 2016 23:03
-
-
Save biglovisa/2f0e43373e641612c37b to your computer and use it in GitHub Desktop.
CODE
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
$(document).ready(function() { | |
renderAllItems(); | |
fetchToken(); | |
}); | |
function fetchToken() { | |
$.ajax({ | |
url: '/api/v1/env_variables.json', | |
type: 'GET', | |
success: function(response) { | |
console.log('SUCCESS', response); | |
}, error: function(xhr) { | |
console.log('NO', xhr); | |
} | |
}) | |
} | |
function renderAllItems() { | |
$.ajax({ | |
url: '/api/v1/skills', | |
type: 'GET', | |
success: function(response) { | |
renderSkillsOnDOM(response); | |
}, error: function(xhr) { | |
console.log('FAIL', xhr); | |
} | |
}); | |
} | |
function renderSkillsOnDOM(skills) { | |
var htmlSkills = skills.map(function(s) { | |
return ( | |
'<h1>' + s.name + '</h1>' | |
) | |
}); | |
$('#all-items').append(htmlSkills); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment