-
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
dataTypeasjsonp - Be sure to add a
successcallback 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 havecourseas a CSS class - first child of the
.courseelement is an<h3>tag that contains thecourse.titleof the course as its contents - right after the
<h3>, let's add an<img>element that has thesrcattribute 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-primaryCSS classes, has thetargetattribute set to_blank,hrefattribute set to thecourse.urland 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: