I’m working on the exercise of the Random Quote Generator and I do not get why this is not working.
Link is right here:
code on JS that is not working:
var ourQuote = "";
var ourAuthor = "";
function getQuote(){
$.ajax({
url: 'https://andruxnet-random-famous-quotes.p.mashape.com/cat=', // The URL to the API. You can get this in the API page of the API you intend to consume
type: 'GET', // The HTTP Method, can be GET POST PUT DELETE etc
//data: {}, // Additional parameters here
dataType: 'json',
success: function(data) {
var r = JSON.parse(data);
ourQuote = r.quote;
ourAuthor = r.Author;
$("#quote").html("ourQuote");
$("#author").html("ourAuthour");
},
error: function(err) { alert(err); },
beforeSend: function(xhr) {
xhr.setRequestHeader("X-Mashape-Authorization", "OivH71yd3tmshl9YKzFH7BTzBVRQp1RaKLajsnafgL2aPsfP9V"); // Enter here your Mashape key
}
});
}
$(document).ready(function(){
getQuote();
$(".qButton").on('click', getQuote);
});