jquery ajax 局部刷新小案例
时间:2021-07-01 10:21:17
帮助过:23人阅读
代码如下:
<html>
<head>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
function getOtherMessage(){
$.ajax({
type:"post",
url:"${pageContext.request.contextPath}/getOtherMessage.do",
success:function(msg){
$("#view").html(msg);
},
error:function(){
alert("wrong");
}
});
}
</script>
</head>
<body>
<input type="button" value="修改" onclick="getOtherMessage();" />
<div id="view">
456
</div>
</body>
</html>