-
Notifications
You must be signed in to change notification settings - Fork 976
Expand file tree
/
Copy pathmain.js
More file actions
35 lines (29 loc) · 777 Bytes
/
main.js
File metadata and controls
35 lines (29 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$(function() {
$.ajax({
url: 'https://www.codeschool.com/users/cgamache808.json',
dataType: 'jsonp',
success: function(response) {
addCourses(response.courses.completed);
}
});
function addCourses(courses) {
var $badges = $('#badges');
courses.forEach(function(course){
var $course = $('<div />', {
'class': 'course'
}).appendTo($badges);
$('<h3 />', {
text: course.title
}).appendTo($course);
$('<img />', {
src: course.badge
}).appendTo($course);
$('<a />',{
'class': 'btn btn-primary',
target: '_blank',
href: course.url,
text: 'See Course'
}).appendTo($course);
})
}
});