tags:

views:

183

answers:

8

Does javascript coding work better with any particular server language?

+15  A: 

No. Client Side JavaScript is unaffected by the language used to code the server side processing.

Kevin
Thanks I was unsure I kept hearing jsp was tougher to work with it.
They might have been saying it's just confusing to remember which side you're on when both languages are the same. I'm sure you'd get used to it pretty quickly though.
Spencer Ruport
@unknown - Java is not Javascript. JSP is Java Server Pages.
StingyJack
+1  A: 

No, but there is better integration in certain situations, where server-side code will generate javaScript automatically, such as the .NET framework and the Google Web Toolkit.

Diodeus
or any other RAD that uses Javascript - available in tons of other web languages.
Syntax
A: 

Presuming that you mean client-side JavaScript, no. By the time that JavaScript is executing, it's in an environment where server-side code isn't visible. In fact, it would be tricky for JavaScript to even determine what server-size environment created the document it's acting on. All it sees is the output.

Jekke
+3  A: 

If you are planning to do any kind of XML/"AJAX" stuff, make sure that your language of choice on the server side has robust XML and JSON libraries. If you aren't using it in this manner, it shouldn't make any difference. Having proper libraries will save you a lot of headache later on since you won't be forced to build your own.

Nolte Burke
A: 

Client Side javascript is bound to the browser and not to any specific language. It is all based on the actual output of your server to the clients browser.

Syntax
+2  A: 

The short answer is no.

The long answer is that, no, but you should still simplify the interface between your server-side code and JavaScript:

  1. Use a standardized data serialization format (XML or JSON being the most popular forms). Make sure your serializers and parsers are symmetric; i.e. that you can freely read and generate data on both sides. Do not assume you will always be reading on the client and writing on the server.

  2. Limit manually crafting JavaScript on the server side to a minimum. Try not to dump JavaScript functions with inline script blocks. Try attaching event listeners to elements with JavaScript instead of using onclick or href="javascript:".

mustpax
A: 

Perhaps the question should be - how or why would the server language make a difference. In the end text is being spit out which is possible regardless of language/platform.

mP
A: 

If you have javascript on the serverside, you can share code- For instance by doing client side form validation, and using the same validation code on the server before submitting it to a database.

Breton