Been working with this for a while and found a few helpful things, but I'm not good with AJAX yet...
I'm working to make a chromium-browser kiosk on the Raspberry Pi (which has been fine) but when in kiosk mode, there's not a "shutdown" button. I'm displaying a local HTML file in the chromium-browser and I want to create a button in the local HTML file that will shutdown the computer using AJAX/JQuery by calling a simple python code I made:
#! /usr/bin/python -u
import os
import shutil
import sys
os.system('sudo shutdown -h now')
I found this:
$.ajax({
type: "POST",
url: "~/shutdown.py",
data: { param: text}
}).done(function( o ) {
// do something
});
How do I connect this though? there's no output from my python, just want to call the python code and have the raspberry pi shutdown. The python code when I run it in its own terminal shuts down the computer as expected.
Or if you have any other ideas for shutting down the Rpi while in Kiosk mode in the most "user friendly" way, let me know! The people using this won't know about using the terminal or SSH-ing in...
Thanks!