前端之家收集整理的这篇文章主要介绍了
使用ajax实现动态局部刷新,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<span style=
"font-size: medium;"
>refresh.jsp
<%@ page contentType=
"text/html;charset=UTF-8"
language=
"java"
%>
<head><Meta http-equiv=Content-Type content=
"text/html; charset=UTF-8"
></head>
<script language=
"javascript"
>
var XMLHttpReq;
function createXMLHttpRequest() {
if
(window.XMLHttpRequest) {
XMLHttpReq =
new
XMLHttpRequest();
}
else
if
(window.ActiveXObject) {
try
{
XMLHttpReq =
new
ActiveXObject(
"Msxml2.XMLHTTP"
);
}
catch
(e){
try
{
XMLHttpReq =
new
ActiveXObject(
"Microsoft.XMLHTTP"
);
}
catch
(e) {
}
}
}
}
function sendRequest() {
createXMLHttpRequest();
var url =
"refresh.do"
;
XMLHttpReq.open(
"POST"
,url,
true
);
XMLHttpReq.onreadystatechange = processResponse;
@H_
403_289@
XMLHttpReq.send(
null
);
@H_175_
301@