javascript - Specify which form to do post call -


i 1 post call html form fields. how specify values post call with? instance, want 2 separate post ajax call username/password , username/email.

$('form').submit(function() {   $.ajax({     type: "post",     url: $('form').attr('action'),     data: $(this).serialize(),     success: function(data, status, xhr) {       alert("login successful. redirecting");       window.settimeout(function() {         window.location.href = "3.3.3.3/login"       }, 5000);      },     error: function(data, status, xhr) {       $('form').trigger("reset");       alert("failed login. please try again.");     }   });    return false;   alert("ajax request completed"); }); <html> 

html

<head>   <title>log in</title>    <link rel="stylesheet" href="static">   <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> </head>  <body>   <form action="1.1.1.1/login" method="post">      <div class="login">       <div class="login-screen">         <div class="app-title">           <h1> login</h1>         </div>         <input class="form-control" type="text" required name="username" placeholder="username">         <input class="form-control" type="password" required name="password" placeholder="password">         <input class="form-control" type="hidden" required name="eauth" value="pam">         <input class="form-control" type="text" required name="email" placeholder="email">          <p>           <input type="submit" value="log in" />         </p>       </div>     </div>   </form> </body>  </html> 


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -