Random Quote Machine API calls not working. What am I missing?

Hey guys,

If someone could be kind enough to have a look at my code and tell me what I’m doing wrong, it would help alot. I’ve tried several things over the past couple of days but quite frankly, this getJSON and AJAX stuff is a little beyond my current knowledge. I’ve tried the array method and that works ok but I believe JSON and APIs are the way we are expected to do this project.

Here’s the link to my pen.

Please let me know what I need to do to get it running.

Thanks
Suraj

You need to request ‘https’, and you didn’t close your ‘success:’ function properly. This fixes it.

  $.ajax({
     url: "https://api.forismatic.com/api/1.0/",
     jsonp: 'jsonp',
     dataType: 'jsonp',
     cache: false,
     data: {
        method: "getQuote",
        lang: "en",
        format: "jsonp"
     },
     success: function(response) {
        console.log(response.quoteText);
        $('.quoteBox').text(response.quoteText);
     }
  });

});
});

Thank you so much it worked! Changed it to https and voila. That one ‘s’ kept me frustrated for a whole week. Thanks and cheers! Onwards!

Added your name to the footer :wink: