<script type="text/javascript" src="js/jquery-3.0.0.js"></script>
<script type="text/javascript"> $(function(){ $("#txtName").blur(function(){ $.post("ajax.do",{'name':$("#txtName").val()},function(data){ alert(data); }); }); }); </script>
</head>
<body>
用户名:<input type="text" id="txtName"/>
</body>
@Controller
public class AjaxController {
@RequestMapping("/ajax")
public void ajax(String name,HttpServletResponse resp) throws IOException{
if("siggy".equals(name)){
resp.getWriter().println("true");
}
else{
resp.getWriter().print("false");
}
}
}
未完待续。。。