How to pull login data to Parse.com with Javascript?

1

I am not able to pull the login data from the form HTML , I need these values go to the code JavaScript , I already have the user in database and also the APIs Keys , I was able to create the user with a example of the parse documentation itself and now I am trying to login to test, but without success.

  

Note: I removed the Keys from the code

Here's how my code works:

<!doctype html>
<head>
  <meta charset="utf-8">

  <title>My Parse App</title>
  <meta name="description" content="My Parse App">
  <meta name="viewport" content="width=device-width">
  <link rel="stylesheet" href="css/reset.css">
  <link rel="stylesheet" href="css/styles.css">
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><scripttype="text/javascript" src="http://www.parsecdn.com/js/parse-1.4.2.min.js"></script></head><body><divid="main">
    <h1>Login</h1>

    <p>Login do usuario</p>
     <form id="login">
        User name:<br>
        <input type="text" id="username" name="username">
        <br>
        User password:<br>
        <input type="password" id="password" name="password">
        <input type="submit" value="Enviar">
      </form>

  <script type="text/javascript">    
    Parse.initialize("", "");

    Parse.User.logIn("#username", "#password", {
      success: function(user) {
        // Do stuff after successful login.
        alert("Sucesso: ");
      },
      error: function(user, error) {
        // The login failed. Check error to see why.
        alert("Error: " + error.code + " " + error.message);
      }
    });
  </script>
</body>

</html>

I've been reading the Parse documentation and it looks like I need to create an object to receive these values, does that work?

Hugs!

    
asked by anonymous 03.06.2015 / 08:05

0 answers