Random Quote Machine, {Batch Complete}

Random Quote Machine, {Batch Complete}
0

#1

So, below is my code. I believe I’m on the right track, but I don’t fully understand how to actually filter down to pull a quote. I’m getting {Batch Complete} which tells me I’m getting some level of success. But knowing how/where to filter quotes out is where I’m getting lost.

$(document).ready(function(){

  var API =  "https://api.forismatic.com/api/1.0/";

 $("#quoteBTN").on('click', function(){
     $.ajax({
       url: API,
       dataType: "jsonp",
       data: {
         format: "json",
         action: "query",
       },
       success: function(data) {
         console.log(data);
       }
     });
} );
});

#2

Do you have a Codepen link you can share of this project? I am getting an error with just this code.


#3

it’s quite simple.


#4

I am getting the same error in the browser console (Ctrl+Shft+J in Chrome). Below is the error I receive:

Mixed Content: The page at ‘https://codepen.io/rynsp8/pen/rYjKdN’ was loaded over HTTPS, but requested an insecure script ‘http://forismatic.com/’. This request has been blocked; the content must be served over HTTPS.


#5

oh geez, I forgot I switched to attempt to use forismatic, I was using wikiquotes. Let me update.

Thanks for taking what time you can to look at this. I appreciate it.


#6

OK, here is the code using wikiquotes, when you use the “Quote Me!” button, it logs “Batch Complete” to the console.

$(document).ready(function(){

  var API =  "https://en.wikiquote.org/w/api.php";

  $("#quoteBTN").on('click', function(){
     $.ajax({
       url: API,
       dataType: "jsonp",
       data: {
         format: "json",
         action: "query",
       },
       success: function(data) {
         console.log(data);
       }
     });
} );
});