Why do you need different scripting for client and server side?
Partly because the available scripting languages are different: JavaScript runs primarily in the browser, which server side languages like PHP, JSP, Ruby on Rails etc. cannot do.Partly because the tasks are different: The server may do things like database lookup, reading/writing files and user authentication that would be either impossible or very insecure to do in a browser.That said, there are a number of tasks that can be done either on the client or the server, like generating the HTML for the page.There are also a couple of tasks that are commonly done both places, like form validation - on the client to give quick feedback and on the server to ensure that what is submitted is actually safe and valid. (An attacker could easily skip any browser validation and submit illegal values.)If you wish to share as much code between client and server as you can, server side JavaScript exists, so it is possible to use the same language both places. There will still be different scripting, as there are tasks that can only be done on the server.See related link for some server side JavaScript options.