title: How to redirect to another page after making a POST request with jQuery ajax?
body: <p>On my web app I have a button that when clicked takes the values from some user input and posts it to a flask route.</p>
  
  <pre><code>$( "#button" ).click(function() {
    let data1 = // get data
    req = $.ajax({
                url: '/test',
                type: "POST",
                data: { data1: data1
                    }
              });
  </code></pre>
  
  <p>Here is the flask route:</p>
  
  <pre><code>@app.route('/test', methods=['GET', 'POST'])
  def testing():
      if request.method == 'POST':
          data = request.values.get('data1')
          # here I make some changes to data but it isn't important to question
          new_data = ...
          # I want to redirect to a new route with new_data
      else:
          # do something else...
  </code></pre>
  
  <p>How can I, after the post request, get redirected to a new route and still be able to access my new_data variable?</p>