title: Return error message from flask to same form in a modal
body: <p>HTML: I have a 'sign-up' form in a modal (index.html)</p>
  
  <p>JS: The form data is posted to a python flask function: /signup_user</p>
  
  <pre><code>  $(function () {
  $('#signupButton').click(function () {
    $.ajax({
      url: '/signup_user',
      method: 'POST',
      data: $('#signupForm').serialize()
    })
      .done(function (data) {
        console.log('success callback 1', data)
      })
      .fail(function (xhr) {
        console.log('error callback 1', xhr);
      })
    })
  }); 
  </code></pre>
  
  <p>Python/Flask:</p>
  
  <pre><code>@app.route('/signup_user', methods=['POST'])
  def signup_user():
  #Request data from form and send to database
  #Check that username isn't already taken
  #if the username is not already taken  
      if new_user:
          users.insert_one(new_user)
          message = "Success"
          return message
  #else if ussername is taken, send message to user viewable in the modal
      else:
          message = "Failure"
          return message
  return redirect(url_for('index'))
  </code></pre>
  
  <p>I cannot figure out how to get the flask function to return the "Failure" message to the form in the modal so that the user can change the username.</p>
  
  <p>Right now, as soon as I click the submit button the form/modal disappears and the 'Failure' message refreshes the entire page to a blank page with the word Failure.
  How do I get the error message back to display in the form/modal?</p>