0

i'm trying to have an api call to the following json url, which opens just fine in a browser: http://api.forismatic.com/api/1.0/GET?method=getQuote&format=json&key=&lang=en However, when i'm doing it using getJson, it's not displaying anything. What could be the error?

Below is the simple code:

$(document).ready(function() {

  $("#getQuote").on("click", function() {

    $.getJSON("//api.forismatic.com/api/1.0/GET?method=getQuote&format=json&key=&lang=en", function(json) {
      $(".quote").html(JSON.stringify(json));

    });

  });

});

The codepen where it's supposed to run is here: http://codepen.io/Willvlad/pen/VaedOP

What could be a mistake?

Vlad
  • 465
  • 7
  • 26
  • Open the browser's JavaScript console and google the error message. – JJJ Mar 08 '16 at 00:27
  • Possible duplicate of [Simple XMLHttpRequest fails with Access-Control-Allow-Origin header null](http://stackoverflow.com/questions/35280550/simple-xmlhttprequest-fails-with-access-control-allow-origin-header-null) – Fabian Horlacher Mar 08 '16 at 01:09

0 Answers0