Skip to content

Commit 33ae48d

Browse files
committed
update readme
1 parent 9255fcb commit 33ae48d

File tree

1 file changed

+3
-7
lines changed
  • 06-rest-api/00-xml-http-request/01-implementation

1 file changed

+3
-7
lines changed

06-rest-api/00-xml-http-request/01-implementation/README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ xhr.send();
2929

3030
> [readyState official docs](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState)
3131
32-
3332
To get the data, we can use, for example, `responseText`:
3433

3534
```diff
@@ -46,7 +45,6 @@ xhr.send();
4645

4746
```
4847

49-
5048
So 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

Comments
 (0)