My javascript code with jquery is
$("#quoteid").on("click", function() {
$.getJSON("http://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=json&lang=en", function(quotejson) {
$("#quotegot").html(quotejson["quoteText"]);
});
});
The ID "quoteid" is linked with a button in the page and the #quotegot is linked with a text box. Whenever I run the code, and press the button, a message in the console is displayed which says that
XMLHttpRequest cannot load http://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=json&lang=en. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://s.codepen.io' is therefore not allowed access.
Whatever API I use, I get the same error. What should I do?