I am very new to html and webpages(being an embedded engineer). I have got a task to automate few processes which requires a python script to be executed on Raspberry pi when we click a button on webpage.
What i want is a process where the python code can be executed directly on the pi when we click a button on the webpage. I have tried javascript, bryhton and pretty much everything that i could
Here is the html page that i designed.What this piece of code does is it reads the contents of python script rather than executing it on the board.
Please guys suggest me a method to do it. Thanks in advance.
<!DOCTYPE html>
<html>
<body>
<h1><b>Remote Diagnostic Method</b></h1>
<button id="greet-button" onclick="RunPython()">Say Hello</button>
<script src="http://code.jquery.com/jquery-3.3.1.min.js"></script>
<script >
function RunPython()
{
$.ajax({
url: "add.py",
}).done(function(response) {
alert(response);;
});
}
</script>
</body>
</html>