File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,11 +123,17 @@ First, let's create a function that does the AJAX call to the GitHub API.
123123``` js
124124function getGithubInfo (username ) {
125125 var xhr = new XMLHttpRequest ();
126- xhr . open ( ... );
126+ // open and then send the request
127127
128128 return xhr;
129129}
130130```
131+ > Set the async parameter to false so the call is synchronous.
132+ This means the browser will wait for the call to the GitHub API to finish before continuing.
133+
134+ > Otherwise you can set it to true and add the extra methods to handle the changes in ` readyState ` of the request.
135+
136+ > See [ Mozilla Developer Network (MDN)] ( https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/onreadystatechange ) for more details.
131137
132138** Note** We want ` getGithubInfo(username) ` to return us the entire response, so we can check for the status and handle it when necessary.
133139
@@ -174,8 +180,11 @@ The `showUser(user)` function should:
1741803 . Add an image in ` #profile .avatar ` . To do that, you can use the ` avatar_url `
175181 from the response.
176182
183+ > Once you have parsed the response, try using ` console.log() ` to see what the object looks like in the browser console.
184+
177185> Don't forget to call ` showUser() ` from the function handling the keypress!
178186
187+
179188##Publish to Github
180189
181190Link to your Github User Finder from ` index ` and push your changes to Github.
You can’t perform that action at this time.
0 commit comments