Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a PHP file with a JavaScript and on clicking 'submit', the js should be called.

But nowhere I can find this solution done. I am unable to get my JavaScript work in this Linux server. But the same piece of code works in Windows. Is there any thing in particular I need to install in Linux?


It's a normal JavaScript. Like, if I enter user name and password in my login.php page, on click of submit button, the JavaScript has to perform the validation script to correct user was logged or not. But this script is not getting called. Is there anything that I need to install for JavaScript to work in my Linux system?

Because the same script works in my Windows system. This is happening to all my JavaScripts whereever I call, not specific to this login page.

share|improve this question
3  
Do you mean javascript or java and then some scripts? They are different things. –  user68186 Jun 27 '13 at 12:44
    
Assuming we are talking about Javascript, this might be useful for you. –  jokerdino Jun 29 '13 at 17:36
    
Javascript is run in the client (most of the cases) and from the information you gave us is doubtful you need to do something in the server. Please, check the console on the client looking for possible errors and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance. Edit your question and include the information asked. –  Braiam Sep 10 '13 at 14:06
add comment

closed as too broad by hexafraction, Thomas W., Eric Carvalho, Kevin Bowen, Radu Rădeanu Jun 28 '13 at 7:49

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

javascript is a client-side language. When a browser opens the PHP script, the JS will be served to the client as part of the page, and will be run there. If you're asking about node.js, that's another technology that needs to be installed and runs its own set of Javascript, slightly different from standard Javascript.

If you're talking about scripts in Java, install openjdk-6-jre-headless or openjdk-7-jre-headless and use java nameoffile where the .class is removed from the filename in the command.

Anyway in response to your reply, you shouldn't use Javascript for that as it is easily defeated. Use PHP on the server-side for security.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.