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

JavaScript and Registration Forms.

Hi! Can you use JavaScript to retrieve and store information on a database? Or would you want to learn PHP or something else? I'm wanting to make a simple registration form for a Forum website, and i'm confused between all the different languages and stuff like node.js, jQuery, etc.. Can someone clear this up for me?

Technically speaking, you can use JavaScript, but only if you use node.js. Otherwise, you're correct in that you'd have to use a server-side language (i.e.: Node.js, PHP, Ruby etc).

1 Answer

The most basic thing you need to understand is that to make any website work, there is some code that runs on the server and some code that runs on the client (browser). JavaScript is the ONLY programming language that can be used in the browser.

However, since what you want is to store information in a database, you will need at least SOME server-side code to store and retrieve information from the database. You COULD use a server-side implementation of JavaScript called Nodejs, or you could use PHP, Python, Ruby, etc..

If your website already exists, I'd recommend PHP because it's pretty easy to splice into an already existing static website, assuming you have a normal hosting environment. If you are building something from scratch and want to learn something, Python or Ruby would probably teach you more.

Thank you. I think I will go try out Ruby and Python to see which one I'd prefer. It'd be useful to have a little bit of server-side language knowledge under my belt to use when needed.