I think my problem is that flask can't find the key and value of my java script. So, how can I fix it? Here is my python:
def ledStudy_handler():
if request.form['study'] == "on":
GPIO.output(11, GPIO.HIGH)
print("lights on")
elif request.form['study'] == "off":
GPIO.output(11, GPIO.LOW)
print("lights off")
return render_template("home.html")
And here is my js:
function ledStudy() {
var checkStudy = document.getElementById("checkStudy");
if (checkStudy.checked == true){
var checkStudy.study = "on";
}
else {
var checkStudy.study = "off";
}
}