首页 新闻 会员 周边 捐助

spring框架ajax

0
悬赏园豆:20 [已关闭问题] 关闭于 2015-12-26 20:13

$(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);为甚么在页面上显示不出来,急求解决!!!

monkey456的主页 monkey456 | 初学一级 | 园豆:107
提问于:2015-12-17 22:56
< >
分享
所有回答(1)
0

你直接在success中alert(result);看看具体是什么

MrNice | 园豆:3468 (老鸟四级) | 2015-12-18 08:24
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册