无法通过网页将数据上传到Parse.com

时间:2015-10-26 10:00:26

标签: javascript jquery html css parse-platform

我是 Parse数据库的新手。我正在实现一个代码,让我注册并将值存储在解析数据库中。但不知何故,价值观没有上传。我已经实现了以下代码:

<!DOCTYPE html>
<html >
  <head>
    <meta charset="utf-8">
    <title>Multi Step Form with Progress Bar using jQuery and CSS3</title>


    <link rel="stylesheet" href="css/style_­signup.css">
    <link rel="stylesheet" href="css/reset_signup.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="https://www.parsecdn.com/js/parse-latest.js"></script>
  </head>

  <body>

    <!-- multistep form -->
<form id="signUpForm">
    <!-- progressbar -->
    <ul id="progressbar">
        <li class="active">Account Setup</li>
        <li>Social Profiles</li>
        <li>Personal Details</li>
    </ul>
    <!-- fieldsets -->
    <fieldset>
        <h2 class="fs-title">Create your account</h2>
        <h3 class="fs-subtitle">Step 1</h3>
        <input id="signUpemailID" type="text" name="email" placeholder="Email" />
        <input id="signUpPassword" type="password" name="pass" placeholder="Password" />
        <input id="signUpRePassword" type="password" name="cpass" placeholder="Confirm Password" />
        <input id="signUpNextButton1" type="button" name="next" class="next action-button" value="Next" />
    </fieldset>
    <fieldset>
        <h2 class="fs-title">Social Profiles</h2>
        <h3 class="fs-subtitle">Your presence on the social network</h3>
        <input id="signUpTwitterProfileLink" type="text" name="twitter" placeholder="Twitter" />
        <input id="signUpFacebookProfileLink" type="text" name="facebook" placeholder="Facebook" />
        <input id="signUpGooglePlusProfileLink" type="text" name="gplus" placeholder="Google Plus" />
        <input id="signUpLinkedInProfileLink" type="text" name="linkedin" placeholder="LinkedIn" />

        <input id="signPreviousButtonPage1" type="button" name="previous" class="previous action-button" value="Previous" />
        <input id="signUpNextButton2" type="button" name="next" class="next action-button" value="Next" />
    </fieldset>
    <fieldset>
        <h2 class="fs-title">Personal Details</h2>

        <input id="signUpFirstName" type="text" name="fname" placeholder="First Name" />
        <input id="signUpLastName" type="text" name="lname" placeholder="Last Name" />
        <input id="signUpPhone" type="text" name="phone" placeholder="Phone" />
        <textarea name="address" placeholder="Address"></textarea>
        <input id="signUpPreviousButtonPage2" type="button" name="previous" class="previous action-button" value="Previous" />
        <input id="signUpSubmitButton" type="submit" name="submit" class="submit action-button" value="Submit" onClick="redirect()" />
    </fieldset>
</form>

<script type="text/javascript">
    Parse.initialize("<APP-ID>", "<CLIENT-KEY>");

    var LoginDetails = Parse.Object.extend("SignUpDetails");

    $("#signUpForm").submit(function(event){

            var emailID = $("#signUpemailID").val();
            var userPass = $("#signUpPassword").val();

            var twitterLink = $("#signUpTwitterProfileLink").val();
            var facebookLink = $("#signUpFacebookProfileLink").val();
            var googlePlusLink = $("#signUpGooglePlusProfileLink").val();
            var linkedInLink = $("#signUpLinkedInProfileLink").val();

            var firstName = $("#signUpFirstName").val();
            var lastName = $("#signUpLastName").val();
            var phone = $("#signUpPhone").val();

            var user = new Parse.User();
            user.set("emailid", emailID);
            user.set("password", userPass);

            user.set("twitterLink", twitterLink);
            user.set("facebookLink", facebookLink);
            user.set("googlePlusLink", googlePlusLink);
            user.set("linkedInLink", linkedInLink);

            user.set("firstName", firstName);
            user.set("lastName", lastName);
            user.set("phoneNo", phone);

            user.signUp(null, {
                success: function(user){
                    //
                    }, error: function(user, error){
                        console.log("signup error:"+error.message);
                        }
                    });


    });
</script>

<!-- jQuery -->
<script src="http://thecodeplayer.com/uploads/js/jquery-1.9.1.min.js" type="text/javascript"></script>
<!-- jQuery easing plugin -->
<script src="http://thecodeplayer.com/uploads/js/jquery.easing.min.js" type="text/javascript"></script>

<script src="js/signup.js"></script>


  </body>
</html>

能否帮我解决这个问题?

1 个答案:

答案 0 :(得分:0)

感谢各位,但我遇到了问题。代码没有进入这一行的阻止位置:

 $("#signUpForm").submit(function(event){

所以我不得不将上面一行改为:

$("#signUpSubmitButton").click(function(event){

它有效!