Spring框架ajax

monkey456 发布于 2015/12/17 22:56
阅读 318
收藏 0
$(function(){
$("#signin").click(function(){
var name=$("#count").val().trim();
var pwd=$("#p").val().trim(); 
$.ajax({
url:"/yabe/login.do",
type:"post",
data:{"email":name,"pwd":pwd},
dataType:"json",
success:function(result){
if(result.status==0){
var userId=result.data;
addCookie("id",userId,2);
window.location.href="main.html";
}else if(result.status==1){
$("#count_msg").html(result.msg);
}else if(result.status==2){
$("#pwd_msg").html(result.msg);
}
}
});
});

});


<p id="username-field">

email:<input type="text" name="email" id="count" value="" />

<span id="count_msg"></span>
</p>
<p id="password-field">
Password:
<input type="password" name="pwd" id="p" value="" />
<span id="pwd_msg"></span>
</p>
<p id="remember-field">
<input type="checkbox" name="remember" id="remember" value="true"  />
<label for="remember">Remember me</label>
</p>
<p id="signin-field">
<input type="submit" id="signin" value="Log in now" />
</p>


$("#count_msg").html(result.msg);为甚么在页面上显示不出来,急求解决!!!

加载中
0
分流砥柱
分流砥柱
代码是否执行到,result.msg是否值?
m
monkey456
问题已经解决了,是submit控件的问题,应该改成button,不过,还是谢谢了!
返回顶部
顶部