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

WordPress Build a Website with WordPress WordPress Widgets and Custom Menus How to Create Widgetized Areas in WordPress

Karina Gaulin
Karina Gaulin
790 Points

XMLHttpRequest cannot load

Can a mod please look at this error on my site and help me fix this? karinafarina.com

Karina Gaulin
Karina Gaulin
790 Points

Moderator edit: Error captured from console:

XMLHttpRequest cannot load http://teamtreehouse.com/undefined.json. Redirect from 'http://teamtreehouse.com/undefined.json' to 'https://teamtreehouse.com/undefined.json' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://karinafarina.com' is therefore not allowed access.

1 Answer

Kevin Korte
Kevin Korte
28,148 Points

Hey Karina, it looks like there are two issues, the first is your javascript isn't finding, and thus passing in a tth username to get the JSON data back. You can see in the console log it's trying to find /undefined.json which it can't. To find your profile, it should be looking for https://teamtreehouse.com/karinagaulin.json

This is coming from your treehouse.js file.

Secondly, your JSON request is requesting http, but I believe now it has to be requested through https, and I think if you modify the the treehouse.js file with that as well, the CORS error will go away.