<div>
<form id="form1" onsubmit="return false;">
<h1>用户登录</h1>
<input type="text" placeholder="姓名" required="" id="username" />
<input type="password" placeholder="密码" required="" id="pwd" />
<input type="submit" value="登录" class="btn btn-primary" id="js-btn-login"/>
</form>
</div>
$(function(){
$('#form1').submit(function(){
var name = $("#username").val();//名字
var pwd = $("#pwd").val();// 编号
$.ajax({
type:"post",
url:'../../login',
data: {
sno:name,
sname:pwd
},
success:function(res){
//判断返回值
}
});
})
})
困扰了小编一天的问题终于解决了,加油、、、