-
Notifications
You must be signed in to change notification settings - Fork 60
Step by Step
To complete this project, open this project's directory in a text editor. A text editor like Atom or Sublime Text will do that job.
The file called /src/assets/main.js
is where all of your JavaScript code will be written. Open this file in your text editor and file to complete these steps:
Start by finding your Report Card URL on CodeSchool.com and an Ajax request that follows the following requirements:
- Make an AJAX request to your Report Card URL
- Set the
dataType
asjsonp
- Be sure to add a
success
callback defined
You can see a sample Ajax request that is compatible with this step here.
Within the response
we received from our API call there will be an array of the courses you've completed on Code School. You can access this array within the response.courses.completed
field.
Loop through the response.courses.completed
array and for each element in the array, add the following elements to the #badges
element.
- parent
<div>
that holds course information should havecourse
as a CSS class - first child of the
.course
element is an<h3>
tag that contains thecourse.title
of the course as its contents - right after the
<h3>
, let's add an<img>
element that has thesrc
attribute set to thecourse.badge
(which contains the image URL for this course's badge). - after the
<img>
element, let's add an<a>
tag that has thebtn btn-primary
CSS classes, has thetarget
attribute set to_blank
,href
attribute set to thecourse.url
and its text contents as "See Course".
Here is what the ending DOM structure should look like. By now your page should similar to this one: