Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions myAnswer/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="This is where your description goes">
<meta name="keywords" content="one, two, three">

<title>What Would Kanye Do?</title>

<!-- external CSS link -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>

<h1>Kanye Thought of The Day</h1>
<button type="button" name="button">Kanye Says</button>

<h2>Hi I'm Kanye:</h2>
<img src="https://lh3.googleusercontent.com/proxy/lMcVd6xYjcJ2qzp86KQ_Uo09WfZhsqdxRJpctAj48HHuIxgpsBtYsIySe1qSMbpdgs13hDVqflUBMDyRXXveHcgBWHOt0r-getw9L33Q8HikiRQB4Oa6yWt57WQYRP32xyXR8CUDHdY" alt="">
<h3>:</h3>

<script type="text/javascript" src="js/main.js"></script>
</body>
</html>
16 changes: 16 additions & 0 deletions myAnswer/js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//Example fetch using pokemonapi.co
document.querySelector('button').addEventListener('click', getFetch)

function getFetch(){
const url = 'https://api.kanye.rest'

fetch(url)
.then(res => res.json()) // parse response as JSON
.then(data => {
console.log(data)
document.querySelector('h2').innerText = data.quote
})
.catch(err => {
console.log(`error ${err}`)
});
}