I am trying to send 'ip' variable from home.html to my main app.py python file, I have tried many things and none of them worked, Here is what I'm working with:
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
</script>
<script>
$.getJSON("https://api.ipify.org?format=json",
function(data) {
var ip = data.ip
console.log(ip)
})
</script>
@app.route("/ip", methods=["GET", "POST"])
def get_ip():
return render_template('home.html')