Skip to content

Instantly share code, notes, and snippets.

@biglovisa
Created March 7, 2016 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biglovisa/2f0e43373e641612c37b to your computer and use it in GitHub Desktop.
Save biglovisa/2f0e43373e641612c37b to your computer and use it in GitHub Desktop.
CODE
$(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