Bootstrap Email signup form with Parse backend

2019-08-31 12:13发布

问题:

[edited] I'm trying to include an email signup box on my website with Parse on the backend.

Problem: The email ids entered aren't getting saved into the Parse database.

here's the HTML with corresponding JS. I'm still learning JS so I might have picked up some code from here and there.

<form id="signup-form" class="align-center">
    <div class="form-group align-center" style="width: 90%;">
        <input type="text" class="form-control" name="email" id="email" placeholder="get informed when it's online!" style="font-size: 1em; width: 100%; float: left;"/>
        <button id="signup-button" class="btn btn-default" style="margin-top: 10px;" >count me in!</button>
    </div>
</form>

Javascript:

$(document).ready(function() {
    $("#signup-button").click(function() {
        Parse.$ = jQuery;
        Parse.initialize("n7cfi9v9FErlM13bSC4qb6obHr0c9lSNmEgyBGTB", "NHA6CciUx6xXCvrQwHGTG48D7ggItvUlrYE36mTT");

        var SignupList = Parse.Object.extend("signup_list");
        var signup = new SignupList();
        signup.save({email: $('#email').val()}).then(function(object) {
            alert($('#email' + " enrolled in list!").val());
        });
    });
});

Don't know what I'm doing wrong. Help.