Calling parse javascript function from HTML form event

w00t

New Member
I've been trying to call a simple javascript login function from an html form submission and it doesn't seem to be calling the method. I have tried moving the method to an external .js class and the function still is not working. The java script function is in the header called Login() uses the variables from the form to pass them into the web service and login. I've tried calling other functions from an external homepage.js script too and they are not firing the event. My intention is to push to the index.html page if login is successful. Thanks.Code:\[code\]<script type="text/javascript" src="http://www.parsecdn.com/js/parse-1.1.15.min.js"></script> <script type="text/javascript"> Parse.initialize("v9s5EdsZ4u9fSfTpr8SD0u3Xcb56nen1GWge47kV", "fjuiNrsJk3AubBY1zDfosLKDoPxzGgKlUxegxbtx");function Login() { Parse.User.logIn(document.loginForm.uname, document.loginForm.pword, { success: function(user) { window.location="/index.html"; }, error: function(user, error) { // The login failed. Check error to see why. } }); } </script> <style type="text/css"> /* Override some defaults */ html, body { background-color: #eee; } body { padding-top: 40px; padding-bottom: 140px; } .container { width: 300px; } /* The white background content wrapper */ .container > .content { background-color: #fff; padding: 20px; margin: 0 -20px; -webkit-border-radius: 10px 10px 10px 10px; -moz-border-radius: 10px 10px 10px 10px; border-radius: 10px 10px 10px 10px; -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.15); -moz-box-shadow: 0 1px 2px rgba(0,0,0,.15); box-shadow: 0 1px 2px rgba(0,0,0,.15); } .login-form { margin-left: 65px; } legend { margin-right: -50px; font-weight: bold; color: #404040; } </style> </head> <body> <div id="topBar"> <button onclick="WarningSigns()" class="btn btn-danger" type="button">Warning signs</button> </div> <div id="content"> <div id="titleContent"> <h1>Bronchiectasis</h1> <p id="subTitle">Self-management action plan <p> </div> </div> <div class="container"> <div class="content"> <div class="row"> <div class="login-form"> <h2>Login</h2> <form name="loginForm" action="javascript:Login()"> <fieldset> <div class="clearfix"> <input name="uname" type="text" placeholder="Username"> </div> <div class="clearfix"> <input name="pword" type="password" placeholder="Password"> </div> <button class="btn primary" type="submit">Sign in</button> </fieldset> </form> </div> </div> </div> </div> <!-- /container --> </body>\[/code\]
 
Back
Top