Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Morten Kose
Morten Kose
10,833 Points

Please help with Json Ajax API

Whats wrong with my code?

var quotesAPI = "http://quotes.stormconsultancy.co.uk/random.json";
function showQuote(randomQuote){

and getting error:

VM6780 jquery.min.js:4 Mixed Content: The page at 'https://codepen.io/mortenko/pen/XRKgNX/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://quotes.stormconsultancy.co.uk/random.json'. This request has been blocked; the content must be served over HTTPS.

working with this in CodePen

Cheers, Morten

1 Answer

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there! It seems to be requiring that the endpoint be over a secure connection. HTTP and HTTPS are protocols and HTTPS is the secure version of HTTP. I would first try changing this: http://quotes.stormconsultancy.co.uk/random.json to https://quotes.stormconsultancy.co.uk/random.json. Note the https protocol in the second version as opposed to the http in the first version.

Hope this helps! :sparkles:

Morten Kose
Morten Kose
10,833 Points

Hi Jennifer! I allready tried to change http to https and got following error: VM6780 jquery.min.js:4 GET https://quotes.stormconsultancy.co.uk/random.json net::ERR_INSECURE_RESPONSE