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

APIs Posting Data with fetch()

Joseph Michelini
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Joseph Michelini
Python Development Techdegree Graduate 18,692 Points

When I post, it doesn't post to console. But after a bit I am receiving this super weird error. Help!

What's going on here? I feel like it's beyond the scope of this course but I could be wrong. This error only shows up after maybe 30 seconds? And in the meantime the comment has not been logged to the console. I've resorted to using the "final" code just to make sure I didn't make any errors of my own and it still happens.

alt text

Also, if for some reason you can't zoom in on that here, here's the Imgur link: https://imgur.com/IoIJ2Em

Thanks!

1 Answer

Steven Parker
Steven Parker
229,920 Points

CORS is a security feature in browsers that prevents a page loaded from one site from accessing information from a different site unless it has explicit permissions added by the systems in the HTTP message headers.

I think the workspace server might add these permissions automatically; but if you're working on a system that doesn't do this by default, you'll need to provide server configuration (or code) to allow CORS access.