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 AJAX Concepts AJAX Security Limitations

Can someone please explain the difference between these two examples that Dave mentioned?

.

4 Answers

Steven Parker
Steven Parker
231,248 Points

The difference is where the request comes from. When you perform AJAX, the code is running in the browser. The same-origin policy applies to requests coming from a browser.

But if a server sends a request to another server, that restriction does not apply. That's what the video talks about.

.

Steven Parker
Steven Parker
231,248 Points

Almost. The JS code is stored on the server. Otherwise, you've got it.

.

.

Steven Parker
Steven Parker
231,248 Points

The JS code is only stored on the server, it doesn't run there.
It gets downloaded by the browser and then the browser runs it.