$(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);为甚么在页面上显示不出来,急求解决!!!
你直接在success中alert(result);看看具体是什么