Skip to content

Instantly share code, notes, and snippets.

@pooya-raz
Created March 28, 2019 16:05
Show Gist options
  • Save pooya-raz/3c9748245f74b8da5020ece2fe0cb7b3 to your computer and use it in GitHub Desktop.
Save pooya-raz/3c9748245f74b8da5020ece2fe0cb7b3 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/tugituk
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
fetch('https://www.googleapis.com/books/v1/volumes?q=isbn:9780826476975')
.then(
function(response) {
if (response.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' +
response.status);
return;
}
// Examine the text in the response
response.json().then(function(data) {
console.log(data);
});
}
)
.catch(function(err) {
console.log('Fetch Error :-S', err);
});
</script>
<script id="jsbin-source-javascript" type="text/javascript">fetch('https://www.googleapis.com/books/v1/volumes?q=isbn:9780826476975')
.then(
function(response) {
if (response.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' +
response.status);
return;
}
// Examine the text in the response
response.json().then(function(data) {
console.log(data);
});
}
)
.catch(function(err) {
console.log('Fetch Error :-S', err);
});
</script></body>
</html>
fetch('https://www.googleapis.com/books/v1/volumes?q=isbn:9780826476975')
.then(
function(response) {
if (response.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' +
response.status);
return;
}
// Examine the text in the response
response.json().then(function(data) {
console.log(data);
});
}
)
.catch(function(err) {
console.log('Fetch Error :-S', err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment