<script type="text/javascript" src="${ }/js/jquery-2.1."></script>
<script type="text/javascript">
$(function(){
$("#inp1").blur(function(){
var name=$(this).val();
$.ajax({
url:"${}/demo",
data:{"uname":name,"upwd":"jack123","age":12},
cache:"false",
async:"true",
dataType:"json",
type:"post",
success:function(data){
if(=="1"){
$("#sp").html("Username exists");
}else{
$("#sp").html("");
}
},
error:function(){
alert("server-side exception");
}
});
});
})
</script>
<title>Insert title here</title>
</head>
<body>
<input type="text" value="" ><span ></span>
</body>
</html>