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!

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 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
228,131 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.