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

can you use node.js with ajax?

i know that node.js can be used as backend (as ive heard) and we learn that in the track (soon after the ajax course). however the instructor always uses php as a backend language example. should i learn php or can i just continue with the track, learn node.js, and will that be good enough?

or is node.js very different from php (all i know is that both of them are 'backend languages')

3 Answers

Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 48,565 Points

Hey Sibal,

You can definitely use node.js with AJAX. AJAX is basically a way for the front-end to communicate with the back-end. While the back-end can be any server side language (PHP, Ruby, C#, node.js, etc.), the front-end is javaScript - the language of the browser. AJAX leverages the XMLhttpRequest API (which is javaScript) to transfer data between front and back (note: the data does not have to be XML and is more commonly JSON). More to the point of your question, I would recommend learning node.js, and more specifically javaScript. You don't need to know PHP to use AJAX.

Best,

Clayton

thanks clayton. also if i decide to make a web page later on and want backend functionality, would i still be able to use node.js for that? (or do i need to learn one of the mainstream backend languages like php). i want to try to be complete javascript

Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 48,565 Points

Yep, with node.js you can use javascript for both the front and back end.

CORWIN STREET
CORWIN STREET
6,996 Points

sibal, it would be great if you would upvote the answer that was provided and keep motivating people to ask and answer questions! That being said, great question and answer, folks!