javascript - Parse Connection is not working -
i'm trying connect web application parse database , not working. implement code in html , js don't know wrong because not saving form in data base , main.js. think have put in there don't know what.
this final project.
here code
<!docutype html> <html> <html> <head> <title>erp webapp</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <script type="text/javascript" src="http://www.parsecdn.com/js/parse-1.2.15.min.js"></script> <script type="text/javascript"> parse.initialise("svw5ons8f0arvhqyp5rzs70ycdmpstshn3dbkodo", "jx8gheyaf2umq2gesgeind7ilywfndcwa5uezwnw"); var parseobj = parse.object.extend('registertable'); //create local parse object parse class //$('#submit').bind("click",function(e)){ $('#register').submit(function(e){ //on form submit e.preventdefault(); //get data form var data = { email: $('#email').val(); username: $('#username').val(); password: $('#password').val(); select = $('#select :selected').text(); } //create new parse object parseobj = new parseobj(); //match key values form, parse class, save parseobj.save({ parseobj.set("email", data.email); parseobj.set("username", data.username); parseobj.set("password", data.password); parseobj.set("usertype", data.select); }, { //if successful success: function(parseobj){ alert(parseobj.get('fname') + " " + parseobj.get('lname') + " " + parseobj.get('email') + " saved parse." }, error: function(parseobj, error) { console.log(parseobj); console.log(error); } }) }); //}); </script> </head> <body> <div align = "center"> <h1>register</h1> <br> <form id="register" method="post" onsubmit="formsubmit()"> email: <input id="email" name="email" type="email" ><br> username: <input id="username" type="text" name="username"><br> password: <input id="password" type="password" name="password"><br> <select id="select" name="select" > <option value="alex">alex</option> <option value="maiquel">maiquel</option> </select> <input type="submit" id="submit" value="register"style="width=100px ;height = 30px"> </form> </div> </body> </html>
Comments
Post a Comment