diff --git a/bbquote.js b/bbquote.js new file mode 100644 index 0000000..8b53afd --- /dev/null +++ b/bbquote.js @@ -0,0 +1,17 @@ +document.querySelector('button').addEventListener('click', getQuote) + +function getQuote(){ +const url = "https://breaking-bad-quotes.herokuapp.com/v1/quotes/" + +fetch(url) + .then(res => res.json()) // parse response as JSON + .then(data => { + document.querySelector("h2").innerText = data[0].quote + document.querySelector("h3").innerText = data[0].author + + }) + .catch(err => { + console.log(`error ${err}`) + }); + + } diff --git a/breaking_bad_quote_generator.html b/breaking_bad_quote_generator.html new file mode 100644 index 0000000..ef4d139 --- /dev/null +++ b/breaking_bad_quote_generator.html @@ -0,0 +1,21 @@ + + +
+ + +