I'm trying to create a user login using Parse.com's JS SDK. I try logging in a user I've created in the database, the page reloads and nothing happens. I don't receive any error messages.
function Login() {
<!--Connect to JS SDK-->
Parse.initialize("", "");
event.preventDefault();
//Assign form values to JS variables
var username = $("#login-username").val();
var password = $("#login-password").val();
//Log the user in
Parse.User.logIn("username", "password", {
success: function(user) {
alert("Welcome back, " + username)
var currentUser = Parse.User.current();
if(currentUser) window.location.href = 'gameslist.html';
},
error: function(user, error) {
// The login failed. Check error to see why.
}
});
}
My HTML form:
<form class="form" id="loginForm" role="form">
<div class="inputs">
<input type="text" id="login-username" name="username" placeholder="Username"/>
</div>
<div class="inputs">
<input type="password" id="login-password" name="password" placeholder="Password"/>
</div>
<div>
<input type="submit" id="Login" value="Login" onclick="Login()"/>
</div>
</form>
Some help with this issue would be much appreciated, Thanks!