在表单中添加一个ID,然后将登录按钮转换为提交按钮:
<form id="myform"><label for="username">Username</label><input type="text" id="username" placeholder="Username" /><label for="password">Password</label><input type="text" id="password" placeholder="Password" /><input type="submit" id="login" value="Login"/></form>
然后,不要使用click事件:
$('#login').click(function() {使用Submit事件:
$('#myform').submit(function() {


