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 AJAX Concepts Introducing AJAX

Ajax and the dom

What is the difference between Ajax and the dom manipulation. To me they me they seem to do the same thing

Thanks Steven

1 Answer

Steven Parker
Steven Parker
215,939 Points

You're probably thinking of a case where both are being done by the same code, but the jobs are quite different.

AJAX is about communicating between the client (browser) and the server. Sending a request, getting a response, and then doing something with the response. This final step might involve making page changes, but it doesn't need to.

DOM manipulation is about changing what is being displayed on the page: adding, removing, or re-arranging elements and/or giving them different properties. This could all be done based on a server communication, but it also could very likely be directly in response to user interaction and handled entirely in the browser.