<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-2.1.0.js"></script>
<script type="text/javascript">
$(function(){
$("#inp1").blur(function(){
var name=$(this).val();
$.ajax({
url:"${pageContext.request.contextPath}/demo",
data:{"uname":name,"upwd":"jack123","age":12},
cache:"false",
async:"true",
dataType:"json",
type:"post",
success:function(data){
if(data.flag=="1"){
$("#sp").html("用户名存在");
}else{
$("#sp").html("");
}
},
error:function(){
alert("服务器端异常");
}
});
});
})
</script>
<title>Insert title here</title>
</head>
<body>
<input type="text" value="" id="inp1"><span id="sp"></span>
</body>
</html>
django ajax异步加载 实现局部刷新
最新推荐文章于 2024-04-27 07:15:00 发布