I am trying to execute shell command using JavaScript. I do not want to use a button to execute shell commands but a link (a href).
Below is the code I wanted to try:
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
function GPIO()
{
$.get("index.php");
<?php
$setmode17 = shell_exec("/usr/local/bin/gpio -g mode 17 out");
$gpio_on = shell_exec("/usr/local/bin/gpio -g write 17 1");
?>
return false;
}
</script>
<a href="#" onclick="GPIO();">ON</a>