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 (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,723 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,723 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!