title: How can i send a JavaScript variable back to flask?
body: <p>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:</p>
  
  <pre><code>    &lt;script src=
  "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;
      &lt;/script&gt;
  
      &lt;script&gt;
          $.getJSON("https://api.ipify.org?format=json",
                                            function(data) {
              var ip = data.ip
              console.log(ip)
          })
      &lt;/script&gt;
  </code></pre>
  
  <pre><code>@app.route("/ip", methods=["GET", "POST"])
  def get_ip():
          return render_template('home.html')
  </code></pre>