title: How to create log-out script - Parse (JavaScript)
body: <p>I'm having a problem with logging out on my website. I have looked at the documentation on the parse website but it does not really provide much detail on how to log out the user, also does not help when I am not proficient with JavaScript. </p>
  
  <p>When I click my log out button, it just refreshes the page and nothing more but I would like to take it back to the sign in screen.</p>
  
  <p>My current script file that I have written is shown below (for obvious reasons I have removed my parse unique ids):</p>
  
  <pre><code> $(function() {
  
      Parse.$ = jQuery;
  Parse.initialize("MY CODE HERE", "MY CODE HERE");
  
      $('.form-logout').on('submit', function(e) {
  
      // Prevent Default Submit Event
      e.preventDefault();
  
      //logout current user
      var currentUser = Parse.User.current();
          if (currentUser) {
              Parse.User.logout();
              window.location="Sign_In.html";
          } else {
              window.location="Sign_In.html";
          }
  
      });
  
  });
  </code></pre>
  
  <p>The section where I create the button is located here in my html file:</p>
  
  <pre><code>&lt;form class="form-logout" role="form"&gt;
     &lt;input type="submit" value="Logout" id="logout" class="btn btn-primary btn-lg"&gt;
  &lt;/form&gt;
  </code></pre>