title: Failed to login/wait message and redirect html/css/ajax
body: <p>I am using simple login page(html/css/ajax) to log into the user.
  I have a few things that I want to make, and would appreciate inputs.</p>
  
  <p>1)How do you make a failed to login message if unauthorized? I want to make it just say unauthorized, instead of a hard pop up.</p>
  
  <p>2)Same thing for wait message. How do I alert the user to wait 5 seconds or so before redirecting(I want message to popup as well preferably)?
  I am using window.location = url as redirect as soon as user logs in.
  Also, is there a way to hide the window.location from the users when in production?</p>
  
  <p>And a simple html page with username/password.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $('form').submit(function(){
                       $.ajax({
                              type: "Post",
                              url: $('form').attr('action'),
                              data: $(this).serialize(),
                              success: function (result) {
                              window.location = 'http://login/user/login/';
                              }
                              });
                                            return false;
                       });
      &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>