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.
$( "#button" ).click(function() {
  let data1 = // get data
  req = $.ajax({
              url: '/test',
              type: "POST",
              data: { data1: data1
                  }
            });
Here is the flask route:
@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...
How can I, after the post request, get redirected to a new route and still be able to access my new_data variable?
 
     
     
    