Random Quote Machine - API

Could you tell me why this code doesn’t work for me?

  console.log( "document loaded" );
  var quote, author;
  function getNewQuote(){
      url: "http://api.forismatic.com/api/1.0/",
      jsonp: "jsonp",
      dataType: "jsonp",
      //data: "method=getQuote&format=jsonp&lang=en&jsonp=?"
	  data: {
        method: "getQuote",
        lang: "en",
        format: "jsonp"
      success: function(res){
        quote = res.quoteText;
        author = res.quoteAuthor;

I do not mind helping you out, but it would be best if you ask your question on the forum, so that others can learn from the multiple responses you could receive for your question.

If it is OK with you, I can simply move this question to the Help section on the forum, so you do not have to recreate another thread.

I will definitely respond to your question once it is posted in the main forum.

Also, you might want to be more specific on exactly what you are expecting the code to do and then what is happening instead. It helps others to isolate the problems faster.

Thank you for your quick response. It’s ok with me if you move the question to the appropriate forum. Thanks!

You have two issues:

  1. You accidentally wrote $document().ready instead of $(document).ready

  2. You need to use the https prefix on the url instead of http, because since Codepen using https (secure connection), the browser expects you to make requests to another secure connection.

Thank you very much!