<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
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |