title: Receive data with flask and send data with jQuery
body: <p>!! THIS IS NOT A DUPLICATE !!</p>
  
  <p>The question was not how to get an URL in <code>Flask</code>, but how to send data with <code>jQuery</code> to <code>Flask</code>!</p>
  
  <p>I try to send and receive data with <code>python</code>, <code>Flask</code> and <code>jQuery</code>
  The problem is that I want the full URL of the website and it is impossible to get it with flask because I make 'POST' requests. So with jQuery, I want to send the current URL.
  I don't know how to send data (with <code>jQuery</code>) and receive data (with <code>Flask</code>).</p>
  
  <p><code>Python</code>/<code>Flask</code> code:</p>
  
  <pre><code>@app.route('/invisible', methods = ['POST'])
  def dynamic_refresh():
      return jsonify({'somedata': 'data'})
  </code></pre>
  
  <p><code>HTML</code>/<code>jQuery</code> code:</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function() {
      window.setInterval(function() {
          $.ajax({
              type : 'POST',
              url : '/invisible',
              //I tried to send data from here but it didn't worked
          })
          .done(function(data) {
              console.log(data)
              console.log(window.location.href)//the url I want to send
              //here I use the data received by the server
          })
      }, 5000);
  });
  &lt;/script&gt;
  </code></pre>