I was doing a little project where I want to pass value of variable "x" from javascript to a pyhthon variable get_x. Can someone help me on how to do so.
index.html:
<html>
<body>
<p id="msglog"></p>
<input type="text" id="msg">
<button onclick="myFunction()">></button>
</body>
<script>
function myFunction() {
var x = document.getElementById("msg").value;
document.getElementById("msglog").innerHTML = x;
return x
}
</script>
</html>
main.py:
from flask import Flask, render_template
app = Flask(__name__,template_folder='',static_folder='')
@app.route("/")
def mainpage():
return render_template('/index.html')
app.run(host='0.0.0.0')