php - Jquery login form resubmit on incorrect username or passowrd -
need login form please.
i've set login form through ajax, it's not working when username/password incorrect. php script works when not used through ajax. it's supposed to. when submitting through ajax call, if details incorrect new form pops , asks try again. that's good, can't resubmit form. clicking on submit link doesn't work.
here's code: aside, ajax doesn't use "submit()" load ajax. there separate link outside form needs on "click()".
<script> $(document).ready(function(){ $("#login_submit").click(function() { $("#form2").hide(); $('#finish').html('attempting login'); var username = $("input#username").val(); var password = $("input#password").val(); $.ajax({ url: 'auth.php', type: "post", data: "username="+username+"&password="+password+"", success: function(data) { $('#finish').html(data); } }); }); }); $(document).ajaxstart(function(){ $('#loading').show(); }).ajaxstop(function(){ $('#loading').hide(); }); </script> <div id="form2"> <form method="post" id="login"> <input type="text" name="username" id="username"/><br /> <input type="text" name="password" id="password"/><br /> </form> <span id="login_submit">submit</span> </div> <div id="loading"> loading...<img src="loading/loading6.gif" width="105" height="16" alt="loading" /> </div> <div id="finish"> </div> so said, loads form resubmit, clicking on "submit" doesn't resend information. tips getting resubmit?
data: "username="+username+"&password="+password+"", try as:
data: "username="+username+"&password="+password,
Comments
Post a Comment