Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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