title: Best Practice for "Evaluate Now, Respond Later"?
body: <p>Suppose I'm building a login system.  The user enters a username and password into a field and it is sent via HTTPS to the server, which validates the login before the page loads.  If a bad password is sent, the login obviously fails immediately, but one would want the error message to be displayed later in the page, near the login box.</p>
  
  <p>The obvious solution is to set a global flag and have the login box check it and add the error message if necessary, but my understanding is that global variables are best avoided.  Is there another straightforward method of achieving this functionality?</p>