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.

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
218,813 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.