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 Node.js Basics (2014) Building a Command Line Application Parsing JSON

After taking the AJAX class, I am confused with node.js and AJAX.

When do I use node.js?? and AJAX?

1 Answer

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

tian jin

You use AJAX when you wish to communicate from a web page to a web server. For example, you want to load new content from a web server without loading a new web page, you can use AJAX to send a request to the server, receive the response, and display it on the page. AJAX uses JavaScript in the browser -- also called "client-side JavaScript."

Node.js lets you run JavaScript on a server -- you can use node.js to build server-side apps, or even to build your own web server.

You can also use node.js on your own computer to complete tasks. For example, Grunt.js is a "task-runner" that can help with many of the tasks of web development such as combining and minifying JavaScript files, compiling Sass into CSS.