jonhen
01-14-2012, 01:25 AM
I'm trying to get a server side script to run from a webpage but I just can't get it to run.
I've run this:
<html>
<head>
<script type="text/javascript">
function runscript()
{
alert(“Hello”)
}
</script>
</head>
<body>
<li><a href="javascript required.html" onclick="runscript(); return false;" title="Command">RUN</a></li>
</body>
</html>
and it works ok on both Linux and Windows clients. I've tried this but to no avail:
<html>
<head>
<script type="text/javascript">
function runscript()
{
exec(“/cgi-bin/script.sh”)
}
</script>
</head>
<body>
<li><a href="javascript required.html" onclick="runscript(); return false;" title="Command">RUN</a></li>
</body>
</html>
Here's the script just in case this is the issue but I doubt it:
#!/bin/bash
echo "Content-type: text/html"
echo ""
<some xmlrpc command>
I'm no coder, this is what I've gleaned from hours of surfing and learning. Any help gratefully accepted.
Edit: I'm using Apache2 on a Linux Mint 9 LXDE server and the script runs fine using:
<li><a href="/cgi-bin/script.sh" title="Script">RUN</a></li>
but I have to redirect back to the webpage it's called from and this causes a refresh which is why I'm trying to use javascript.
I've run this:
<html>
<head>
<script type="text/javascript">
function runscript()
{
alert(“Hello”)
}
</script>
</head>
<body>
<li><a href="javascript required.html" onclick="runscript(); return false;" title="Command">RUN</a></li>
</body>
</html>
and it works ok on both Linux and Windows clients. I've tried this but to no avail:
<html>
<head>
<script type="text/javascript">
function runscript()
{
exec(“/cgi-bin/script.sh”)
}
</script>
</head>
<body>
<li><a href="javascript required.html" onclick="runscript(); return false;" title="Command">RUN</a></li>
</body>
</html>
Here's the script just in case this is the issue but I doubt it:
#!/bin/bash
echo "Content-type: text/html"
echo ""
<some xmlrpc command>
I'm no coder, this is what I've gleaned from hours of surfing and learning. Any help gratefully accepted.
Edit: I'm using Apache2 on a Linux Mint 9 LXDE server and the script runs fine using:
<li><a href="/cgi-bin/script.sh" title="Script">RUN</a></li>
but I have to redirect back to the webpage it's called from and this causes a refresh which is why I'm trying to use javascript.