title: reload page after processing javascript output in flask
body: <p>I have a javascript snipped which uses ajax to send an email address to my flask views.py script. I want to send a message to that address if the email is not in my database or otherwise reload the website and show the user information for that email address. Here is my javascript code which sends the data to my views.py</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
      $(".send_invite_message").click(function(evt) {
  
          var Toemail = document.getElementById('To').value
          $.ajax({
              url: "/send_invitation_member",
              type: "GET",
              async: true,
              cache: false,
              dataType: 'json',
              contentType: "application/json; charset=utf-8",
              data: { email: Toemail}, 
              success: function(data) {
                  ///do something
              },
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>and in flask I would like to now have the option to send an email and if the email already exists in the database to reload the site</p>
  
  <pre><code>@app.route('/send_invitation_member', methods=['GET'])
  def send_invitation_member():
  
      if request.method == 'GET':
          email = request.args.get('email')
  
          search_result = check database for email entry
          if search_result:
              return render_template('show_members.html')
          else:
              send message and return json object
  </code></pre>
  
  <p>However the ajax script expects a json object back, so I don't know how to reload the site and show the user information. Is there any way to do this directly in flask or do I need to extend my javascript code and load the site from there?
  thanks
  carl</p>