javascript - Error with User Sign up with Parse -


so i'm using following js function signing users on website. uses parse. currently, function automatically returns account not created after fill info , click on submit. register-submit id of button. there no error messages either on console. i'm new javascript , parse , not sure i'm messing up. appreciated!

<script> $(function(){     event.preventdefault();     $('#register-submit').on('click', function(event) {      parse.initialize("s1ysdcya6vuddvfaxkgegzlxovdf8pfg4ymtvjcy", "kgjrcbggvuyfoiqt8haksjhodu1bextqqgnk0hnl");      var user = new parse.user();       var form = document.getelementbyid("register-form")       var usernameval = form.username.value;       var passwordval = form.password.value;       var emailval = form.email.value;        user.set('username',usernameval);      user.set('password',passwordval);      user.set('email',emailval);       user.signup(null, {         success: function(user) {         form.submit();         alert("account created!");          }, error: function(user,error){             alert("account not created!");         }     });  }); }); </script>   

the form structured following:

   <form id="register-form" method="post" role="form" style="display: none;">                                 <div class="form-group">                                     <input type="text" name="username" id="username" tabindex="1" class="form-control" placeholder="username" value="">                                 </div>                                 <div class="form-group">                                     <input type="email" name="email" id="email" tabindex="1" class="form-control" placeholder="email address" value="">                                 </div>                                 <div class="form-group">                                     <input type="password" name="password" id="password" tabindex="2" class="form-control" placeholder="password">                                 </div>                                 <div class="form-group">                                     <input type="password" name="confirm-password" id="confirm-password" tabindex="2" class="form-control" placeholder="confirm password">                                 </div>                                 <div class="form-group">                                     <div class="row">                                         <div class="col-sm-6 col-sm-offset-3">                                             <input type="submit" name="register-submit" id="register-submit" tabindex="4" class="form-control btn btn-register" value="register now">                                         </div>                                     </div>                                 </div>                             </form> 

can try :

<script> $(function(){     event.preventdefault();     $('#register-form').submit(function(event) {      parse.initialize("s1ysdcya6vuddvfaxkgegzlxovdf8pfg4ymtvjcy", "kgjrcbggvuyfoiqt8haksjhodu1bextqqgnk0hnl");      var user = new parse.user();       var form = document.getelementbyid("register-form")       var usernameval = form.username.value;       var passwordval = form.password.value;       var emailval = form.email.value;        user.set('username',usernameval);      user.set('password',passwordval);      user.set('email',emailval);       user.signup(null, {         success: function(user) {         form.submit();         alert("account created!");          }, error: function(user,error){             alert("account not created!");         }     });  }); }); </script>   

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -