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

JavaScript AJAX Basics (retiring) AJAX and APIs Displaying the Photos

Andrew Lundy
Andrew Lundy
13,269 Points

Trying to do this in Vanilla JS.

Hello, I am trying to accomplish this same thing but without jQuery.

I've been stuck on the CORS issue all morning.

How am I to use the animal option, flickerOptions that get's sent when clicking the button that shows the photos?

Treehouse's markdown for code isn't working so you can view it on GitHub. https://github.com/andrewlundy/practice-api-and-ajax/blob/master/pureJS.js

1 Answer

Steven Parker
Steven Parker
228,991 Points

One of the really cool things about using jQuery for AJAX is how it transparently resolves many CORS issues for you. If you already know you have CORS issues with a site, then perhaps that site isn't the best choice to experiment with using vanilla JS calls on.

If you really want to dig into dealing with CORS directly, I found this article on Using CORS that might be helpful.