Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!doctype html>
<head>
  <meta charset="utf-8">
  <title>My Parse App</title>
  <meta name="description" content="My Parse App">
  <meta name="viewport" content="width=device-width">
  <link rel="stylesheet" href="css/reset.css">
  <link rel="stylesheet" href="css/styles.css">
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  <script type="text/javascript" src="http://www.parsecdn.com/js/parse-1.2.7.min.js"></script>
</head>
<body>
  
  <div id="main">
    <input type="text" class="textinput" id="login-username" placeholder="Username"/>
    <input type="password" class="textinput" id="login-password" placeholder="Password"/>
    <input type="button" class="buttoninput" id="LogIn" value="Log In"/>
    <br />
    <input type="text" id="signup-username" placeholder="Username" class="textinput"/>
    <input type="password" id="signup-password" placeholder="Create a Password"class="textinput"/>
    <input type="button" id="SignUp" value="Sign Up" class="buttoninput"/>
  </div>
  <script type="text/javascript">
      Parse.initialize("YOUR APP ID", "YOUR JAVASCRIPT ID");
      $(document).ready(function () {
          $("#SignUp").click(function () { //when button with id="SignUp" is clicked
              var Username = $("#signup-username").val(); // set var Username = input with id="signup-username"
              var PassWord = $("#signup-password").val(); // set var PassWord = input with id="signup-password"
              var user = new Parse.User(); // creates a new Parse user object
              user.set("username", Username.toString()); //creates a "username" field in the database and sets it to Username
              user.set("password", PassWord.toString()); //creates a "password" field in the database and sets it to PassWord
              user.set("ACL", new Parse.ACL());          //creates a "ACL" field in the database and sets it to Read and Wright for the user.
              user.signUp(null, {
                  success: function (user) {
                      // Parse.user saved
                      alert("Welcome to my app");
                  },
                  error: function (user, error) {
                      // Show the error message somewhere and let the user try again.
                      alert("Error: " + error.code + " " + error.message);
                  }
              });
          });
          $(document).ready(function () {
              $("#LogIn").click(function () {//when button with id="LogIn" is clicked
                  var username = $("#login-username").val(); // set var username = input with id="login-username"
                  var password = $("#login-password").val(); // set var password = input with id="login-password"
                  Parse.User.logIn(username, password, {
                      success: function (user) {
                          // if login is successful
                          alert("You have logged in");
                      },
                      error: function (user, error) {
                          // Show the error message somewhere and let the user try again.
                          alert("Error: " + error.code + " " + error.message);
                      }
                  });
              });
          });
      });
    
    
  </script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
pandasoonpro
0viewers