Help Requested - Random Quote Generator

I’ve read quite a few articles and stack-overflow questions and I still cannot get my random quote generator to deal with the ‘insecure request’ error that I’m seeing. The URL I’m using works in an endpoint tester, like Postman. However, when using a web based compiler, like codepen, I get the following error:

“The page at ‘’ was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ‘ filter[orderby]=rand&filter[posts_per_page]=1’. This request has been blocked; the content must be served over HTTPS.”


<div class="contentContainer">
  <h1 id="quote">"Random Quote Goes here"</h1>
  <h3 id="quoteAuthor">-Quote author goes here</h3>
  <button id="twitterButton">Twitter Icon</button>
  <button id="generateQuoteButton">New Quote</button>


$(document).ready(function() {
  $("#generateQuoteButton").on("click", function() {
    $.getJSON("[orderby]=rand&filter[posts_per_page]=1", function(json) {

Open to any and all suggestions, thank you!

try using “https://…” in your link instead of HTTP

I’ve tried using ‘https’ instead and I get a CORS error.

cannot load[orderby]=rand&filter[posts_per_page]=1. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access. The response had HTTP status code 404.

I added ‘’ to the beginning of the URL, and switched to what appears to be a more stable endpoint and everything appears to be working, in codepen, at least. I’m doing a separate version in angular 1, just to compare the two back to back.

Updated code:

$(document).ready(function() {
  $("#generateQuoteButton").on("click", function() {
    $.getJSON("", function(json) {
1 Like

Spoke too soon. Adding the ‘’ was working as expected for several days but it is now throwing an error, and I haven’t changed any code.

No 'Access-Control-Allow-Origin' header is present on the requested resource.

Can anyone tell me why this works intermittently?

Not sure if you fixed this yet, but i saw someone else post is down… seems to go down every few days, it’s probably not the best option to base your project around it!

Yeah…I’ve noticed. Do you have another suggestion?

I used the Forismatic API ( and just used http on codepen instead of https. Had no issues so far.

1 Like