我的代码如下,你可以帮我查一下吗? 这是一个给出的入门代码,它应该是一个用户注册的函数:
function signUpUser()
{
//alert("clicked button");
//creates new Parse user to be saved to database
var user = new Parse.User();
//grabs the information from our form using jQuery
var username = $("#loginInput").val();
var password = $("#password").val();
//sets the username and password for the User
user.set("username", username.toString());
user.set("password", password.toString());
//can add extra information to user, attributes do not have to be defined beforehand
user.set("favoriteColor", $("#favCol").val());
//user.set("website", "http://www.google.com");
//user.set("email", "email@example.com");
//call signup function to add user to database
user.signUp(null,
{
success: function(user)
{
// Hooray! Let them use the app now.
alert("Successful Signup, you are now logged in");
user.logIn(); //sets Parse.User.currentUser() to be the user variable
},
error: function(user, error)
{
// Show the error message somewhere and let the user try again.
alert("Error: " + error.code + " " + error.message);
}
});//close user.signup
} //closes signUpUser function