How to run a server-side Javascript in Apache
I am running an Apache web server under Linux.
The Java script below suppose to write a file named servertype.conf to a web server under the directory /var/apache/. The Java script responded properly but it did not create a file. This Java script is embedded within a Python script, and the Pyhton script does run. There is an error. Error 'File is undefined' The code var mysummary = new File("/var/apache/servertype.conf") is a server-side script. How do I get this server-side script to work in Apache ? This code is also shown on line number 10 below. =========================== Alternatively, I could use a Server Side Include (SSI) feature to write to a file in a web server with the statement as showned on line number 9 below. The code AddHandler server-parsed .conf would then be added to the file /etc/httpd/conf/httpd.conf So far I could not get either of the two methods to work. I am running Apache version 1.3.26 =========================== Code:
1) <SCRIPT LANGUAGE="Javascript"> |
Ok, I'm not 100% sure of how you're using Javascript, but if you want the user to see that confirm dialog, it must be being run client side in a browser. Consequentally that code you've pasted must be in the html sent to the browser, and the SSI code will have already been parsed by the server before sending the html to the user.
I think your problem is that the JS in this case is executed client side, after the page html is generated and sent. Maybe you need to be passing the dialog result to another page, and/or using a server side language like php to process the form's result (maybe just perl/a cgi script). I've never had to code a site with dynamic pages such as these, so I could be completely wrong, but this is just my suggestion. :) |
reply
Thank you Proud for your help.
|
All times are GMT -5. The time now is 12:14 AM. |