我的 JavaScript 应用程序使用Parse.com 时出现问题。
似乎一切都在正确初始化,只是我似乎无法将任何数据保存到应用程序中。我的函数是否被正确调用?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My Parse</title>
<script type="text/javascript" src="http://www.parsecdn.com/js/parse-1.2.8.min.js">
</script>
</head>
<body>
<script type="text/javascript">
function myFunction() {
Parse.initialize("ID", "PASS");
var self = this;
var user = new Parse.User();
var username = this.$("#signup-username").val();
var password = this.$("#signup-password").val();
user.signUp(null, {
success: function (user) {
alert("Yay!");
},
error: function (user, error) {
alert("Error: " + error.code + " " + error.message);
}
});
}
</script>
<form>Username:
<input type="text" id="signup-username" placeholder="Username" required="yes">
<br>Password:
<input type="text" id="signup-password" placeholder="Password" required="yes">
<br>
<button onclick="myFunction()">Submit</button>
</form>
</body>
</html>