title: Can I reload a div using jQuery?
body: <p>I have an area made up in a navigation by bar some PHP code that either shows a inline login form or the users username. The login form is submit using jQuery so no page load is required to set the users session variables etc. but how can I get around not having to refresh the page so that the correct text is shown (i.e. the users username rather than the inline form)?</p>
  
  <p>At the moment the login works seamlessly without having to refresh the page but I need to somehow update that area also.</p>
  
  <pre><code>        &lt;div id="divLogin"&gt;
          &lt;?php if (!logged_in()) { ?&gt;
          &lt;div class="form-group"&gt;
            &lt;input type="text" placeholder="Email" class="form-control" id="user"&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
            &lt;input type="password" placeholder="Password" class="form-control" id="pass"&gt;
          &lt;/div&gt;
          &lt;button type="button" class="btn btn-success" id="login"&gt;Sign in&lt;/button&gt;
          &lt;button type="button" class="btn btn-primary" id="register"&gt;Register&lt;/button&gt;
          &lt;?php } else { ?&gt;
          &lt;div class="form-group"&gt;
            &lt;p&gt;You are logged in as &lt;strong&gt;&lt;?php echo $_SESSION['user']; ?&gt;&lt;/strong&gt;&lt;/p&gt;
          &lt;/div&gt;
          &lt;?php } ?&gt;
          &lt;/div&gt;
  </code></pre>