@@ -29,7 +29,6 @@ xhr.send();
2929
3030> [ readyState official docs] ( https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState )
3131
32-
3332To get the data, we can use, for example, ` responseText ` :
3433
3534``` diff
@@ -46,7 +45,6 @@ xhr.send();
4645
4746```
4847
49-
5048So to know that everything has gone well, we can wait for the ` readyState ` to be 4 and the ` status ` to be 2xx
5149
5250``` diff
@@ -188,7 +186,8 @@ To avoid having to repeat so much code every time we want to make a call to any
188186 }
189187 };
190188
191- xhr.open("GET", "https://api.github.com/orgs/lemoncode/members");
189+ - xhr.open("GET", "https://api.github.com/orgs/lemoncode/members");
190+ + xhr.open("GET", url);
192191
193192- xhr.setRequestHeader("Accept", "application/xml");
194193+ xhr.setRequestHeader("Accept", "application/json");
@@ -239,7 +238,4 @@ But of course, here are a lot of things missing:
239238- What if we want to add several headers.
240239- Or configure other concepts, such as Cache, CORS, etc.
241240
242- Here is [ another example of XMLHttpRequest] (
243- https://codepen.io/Lemoncode/pen/MWyYbOp?editors=1111 ) with this more elaborate getJSON:
244-
245-
241+ Here is [ another example of XMLHttpRequest] ( https://codepen.io/Lemoncode/pen/MWyYbOp?editors=1111 ) with this more elaborate getJSON:
0 commit comments