diff --git a/src/assets/main.js b/src/assets/main.js index 25601766..def515e7 100644 --- a/src/assets/main.js +++ b/src/assets/main.js @@ -1,5 +1,38 @@ $(function() { - // your code will go here +$.ajax({ + url:'https://www.codeschool.com/users/motorresweb.json', + dataType: 'jsonp', + success: function(response){ + addCourses(response.courses.completed); +} +}); + +function addCourses(courses){ + +var $badges = $('#badges'); + +courses.forEach(function(course){ + + var $course = $('
',{ + 'class': 'course' + }).appendTo($badges); + + $('

',{ + text: course.title + }).appendTo($course); + + $('',{ + src: course.badge + }).appendTo($course); + + $('',{ + 'class': 'btn btn-primary', + target: '_blank', + href: course.url, + text: 'See Course' + }).appendTo($course); + }); + } });