4 ms·
Thanks for sharing, that's really useful. I realized you did the javascript example using XHR Any reason why you didn't use fetch? ``` fetch(url) .then((resp)
by de6u99er 6y ago
Thanks for sharing, that's really useful. I realized you did the javascript example using XHR Any reason why you didn't use fetch?
```
fetch(url)
.then((resp) => resp.json())
.then((data) => { console.log(data) })
```
instead of
```
var requestURL = 'https://api.exchangerate.host/latest'; https://api.exchangerate.host/latest';
var request = new XMLHttpRequest();
request.open('GET', requestURL);
request.responseType = 'json';
request.send();
request.onload = function() {
var response = request.response;
console.log(response);
}
```
- aaomidi 6y agofetch isn't universally supported.