When I use Bootstrap and jQuery, I Google the CDN and then just add the link element to my head section. I am working in a local environment instead of CodePen. I am working on Quote Machine now. Here is my scripts file:
$(document).ready(function() {
var api =
"https://api.forismatic.com/api/1.0/?
method=getQuote&lang=en&format=jsonp&jsonp=?";
$("#generateQoute").on("click", function() {
$.getJSON(api, function(json) {
$("#quote").html(json.quoteText);
$("#author").html("<cite>-- " + json.quoteAuthor + "</cite>");
});
});
});
Can I put that variable in the head section of my html file, so I don’t have to declare a variable inside my script and jQuery function? If I can, what would I replace inside my getJSON method for the URL parameter? Thanks for reading.