81,092
社区成员
发帖
与我相关
我的任务
分享
Map<String, String> map = new HashMap<String, String>();
JSONObject json = null;
if(userService.exist(user) {
map.put("info", "用户名 " + userName + "已存在");
map.put("result", "failed");
json = JSONObject.fromObject(map);
getWriter().write(json.toString());
} else {
map.put("info", "恭喜,用户名" + userName + "还未被注册");
map.put("result", "success");
json = JSONObject.fromObject(map);
System.out.println(json.toString());
getWriter().write(json.toString());
}
$('#signup-username').on('blur',function(event){
$.ajax({
type:"post",
url:"register!userNameValidate.action",
data:"userName="+$('#signup-username').val(),
dataType:'json',
success:function(json){
alert(json.info);
checkusername = true;
check();
},
error:function(json){
alert(json.responseText);
alert(json.status);
alert(json.readyState);
},
});
});