1fetch('http://api.steampowered.com/ISteamUserStats/GetGlobalAchievementPercentagesForApp/v0002/?gameid=221380')
2 .then(function(response) {
3 return response.json();
4 })
5 .then(function(myJson) {
6 console.log(JSON.stringify(myJson));
7 });
8
1fetch(url).then(function(response) {
2 response.text().then(function(dataFromServer) {
3 //do stuff
4 });
5});
1fetch('/about').then(function (response) {
2 // The API call was successful!
3 return response.text();
4}).then(function (html) {
5
6 // Convert the HTML string into a document object
7 var parser = new DOMParser();
8 var doc = parser.parseFromString(html, 'text/html');
9
10 // Get the image file
11 var img = doc.querySelector('img');
12 console.log(img);
13
14}).catch(function (err) {
15 // There was an error
16 console.warn('Something went wrong.', err);
17});
18