标签:UNC ajax .post inf orm for contex pat page
$(function(){
$("#username").blur(function(){
var usernameInput=$(this).val();
$.post(
"${pageContext.request.contextPath}/checkuser",
{"username":usernameInput},
function(data){
var c=data.c;
var usernameinfo="";
if(c>0){
usernameinfo="该用户名已经存在";
$("#usernameinfo").css("color","red");
}else{
usernameinfo="该用户名可以正常使用";
$("#usernameinfo").css("color","red");
}
$("#usernameinfo").html(usernameinfo);
},
"json"
);
});
});
<div class="col-sm-6">
<input type="text" class="form-control" id="username"
placeholder="请输入用户名"><span id="usernameinfo"></span>
</div>
标签:UNC ajax .post inf orm for contex pat page
原文地址:https://www.cnblogs.com/glunko/p/10532959.html