日期:2014-05-18 浏览次数:20755 次
<package name="ajax" extends="json-default" namespace="/ajax">
<action name="userExistsCheck" class="UserAction" method="userExists">
<result type="json">
<!-- 指定不需要序列化输出给客户端的属性列表 -->
<param name="excludeProperties"> users;user;actionMsg;userInfo;id;userService;memberLevelService;session;username;
</param>
</result>
</action>
</package>
<script type="text/javascript">
jQuery(function(){
$("#username").blur(function(){
alert("jaizai");
var url='/ajax/userExistsCheck.action';
var params = {
username:$('#username').attr('value')
};
$.post(url,params,processResponse,'json');
});
function processResponse(date){
if(date.userExists==false){
$("#span1").html("<font color=\"red\">用户名可以使用</font>");
document.getElementById("submit").removeAttribute("disabled");
}else{
$("#span1").html("<font color=\"red\">用户名不可以使用</font>");
document.getElementById("submit").disabled = "true";
}
}
});
</script>