使用parse注册将无法正常工作。未知错误

时间:2015-11-16 00:56:50

标签: javascript jquery html parse-platform

我尝试使用解析创建一个登录但是当我尝试点击提交按钮时,没有响应。我不知道接下来该做什么。困惑的根源是#34;注册表格"。感谢您提供的任何帮助。此外,我使用了解析我的网站的网络应用程序部分。

   <!DOCTYPE html>
<html>
<head>
    <link type="text/css" rel="stylesheet" href="stylesheet.css">
    <script src="bower_components/jquery/dist/jquery.js" charset="utf-8"></script>
    <script src="bower_components/parse/parse.js"> </script>
<script> Parse.initialize("9gnbNsFoQShUFWP0dp96S771Y2oxxuRd8gDdcfe9", "sgBmpwSykCv2Z9qALJj8KgEMP34ILuEFhLRJWkau"); </script>


    <!-- Include Parse! -->
</head>

<body>
    <div class="nav">
        <div class="container">
            <ul>
                <a href="page3.html">Schedule</a>
                <a href="page2.html">Forums</a>
                <a href="page4.html">Sign Up</a>
                <a href="page5.html">Log In</a>
                <a href="index.html">Home</a>
            </ul>
            <div class="heading">
                <center>
                    <h1> 
    <center><img src="https://upload.wikimedia.org/wikipedia/en/thumb/3/30/Winchester_Thurston_School_Logo.svg/220px-Winchester_Thurston_School_Logo.svg.png" 
    alt="Smiley face" style="float:left;width:42px;height:42px;"></center>

    Winchester Thurston </h1></center>
            </div>
        </div>

    </div>
    </div>
    <div class="right">
        <p> News will go here </p>
    </div>

    <form id="register-form" autocomplete="on">
        <h1> Sign up </h1>

        <p>
            <label for="usernamesignup" class="uname" data-icon="u">Username(School Appropriate):</label>
            <input id="usernamesignup" name="usernamesignup" required="required" type="text" placeholder="Username" />
        </p>
        <p>
            <label for="passwordsignup" class="youpasswd" data-icon="p">Password:</label>
            <input id="passwordsignup" name="passwordsignup" required="required" type="password" placeholder="Password" />
        </p>

        <p>
            <label for="emailsignup" class="youmail" data-icon="e">Email(Use WT emal):</label>
            <input id="emailsignup" name="emailsignup" required="required" type="email" placeholder="example@domain.com" />
        </p>

                       <p class="signin button">
            <input class="register-submit" type="submit" value="Register" />
            <script>
                $(function() {
                    var registerForm = $('#register-form');
                    registerForm.on('submit', function(ev) {
                        ev.preventDefault();

                        // Pull fields from the form.

                        window.form = registerForm;

                        // Do parse stuff.
                        var user = new Parse.User();
                        user.set("username", registerForm.find('#usernamesignup').val());
                        user.set("password", registerForm.find('#passwordsignup').val());
                        user.set("email", registerForm.find('#emailsignup').val());
/*          
                        user.set("password", "my pass");
                        user.set("email", "email@example.com");
*/

                        // FINISH IT.
                    });
                });
            </script>
        </p>
    </form>
    </div>
    </div>

    <div class="footer">
        I made this and don't steal it
    </div>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

从Parse documentation开始,您可能在设置

后缺少signUp
user.set("username", registerForm.find('#usernamesignup').val());
user.set("password", registerForm.find('#passwordsignup').val());
user.set("email", registerForm.find('#emailsignup').val());

user.signUp(null, {
  success: function(user) {
    // Hooray! Let them use the app now.
  },
  error: function(user, error) {
    // Show the error message somewhere and let the user try again.
    alert("Error: " + error.code + " " + error.message);
  }
});