title: display username after a user loggs in in jquery
body: <p>I have quotes app that lists quotes i have a login page that works fine but i want to display the username when they logged in
  here is my login method</p>
  
  <pre><code>function logIn() {
      var URL = 'http://localhost:8080/RESTful/rest/crazyquotes/login';
      console.log('logInUser');
      $.ajax({
          type: 'POST',
          async: true,
          contentType: 'application/json',
          url: URL,
          dataType: 'json',
          data: formToJSONLogin(),
          success: function(data, textStatus, jqXHR){
              window.location.replace('http://localhost:8080/RESTful/quotes.html');
              window.alert(showuser());
          },
          error: function(jqXHR, textStatus, errorThrown){
              window.alert('User does not exit');
              console.log(jqXHR);
              console.log(textStatus);
              console.log(errorThrown);
          }
      });
  }
  </code></pre>
  
  <p>my method to get the username </p>
  
  <pre><code>function getusername() {
      var user = JSON.stringify({
          'username': $('#loginuser').val()
          });
      var obj = JSON.parse(user);
      return obj.username;
  
  }
  </code></pre>
  
  <p>I want to display the username here</p>
  
  <pre><code>&lt;div class="bs-Signout"&gt;
          &lt;div class="btn-group"&gt;
              &lt;button type="button" id="currentlogged" data-toggle="dropdown" class="btn btn-primary dropdown-toggle"&gt;I want to display the username here&lt;span class="caret"&gt;&lt;/span&gt;&lt;/button&gt;
              &lt;ul class="dropdown-menu"&gt;
                  &lt;li&gt;&lt;a href="http://localhost:8080/RESTful/index.html"&gt;Sign out&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Edit: I have the method but how do i call it after success so it displays in the quotes.html?</p>
  
  <pre><code>function logIn() {
      var URL = 'http://localhost:8080/RESTful/rest/crazyquotes/login';
      console.log('logInUser');
      $.ajax({
          type: 'POST',
          async: true,
          contentType: 'application/json',
          url: URL,
          dataType: 'json',
          data: formToJSONLogin(),
          success: function(data, textStatus, jqXHR){
              window.location.replace('http://localhost:8080/RESTful/quotes.html');
               getusername();
          },
          error: function(jqXHR, textStatus, errorThrown){
              window.alert('User does not exit');
              console.log(jqXHR);
              console.log(textStatus);
              console.log(errorThrown);
          }
      });
  }
  </code></pre>