Hi all. Attempting to make it through the quote machine challenge. Got through everything but the tweet option. I am trying to go through this all using vanilla javascript, no jquery so most of the examples I am finding are jquery and not helping. I am currently coding everything in atom not code pen so ill copy in my javascript code below. Please help, Thank you!
document.getElementById(“btn”).addEventListener(“click”, loadData);
function loadData(){
var xhr = new XMLHttpRequest();
xhr.onload = function (){
var data = JSON.parse(xhr.responseText);
document.getElementById("one").innerHTML = data.quote;
document.getElementById("two").innerHTML = "- " + data.author;
document.getElementById("hide").style.display = "none";
}
xhr.open("GET","https://andruxnet-random-famous-quotes.p.mashape.com/?cat=famous&count=10", true);
xhr.setRequestHeader("X-Mashape-Authorization", "h2fJssMbfjmsh6JCwB1I5lWmwbc0p1XV8SUjsnHRlasBuAN8pg");
xhr.send();
document.getElementById("twitter").addEventListener("click",tweet);
function tweet (){
document.getElementById(“twitter”).href = “https://twitter.com/intent/tweet?text=” + data.quote + data.author;
}
};