局部刷新一个div
来源:互联网 发布:药智数据app 编辑:程序博客网 时间:2024/04/30 01:19
最近学习ajax,做了个小例子:
<script type="text/javascript">var xmlhttp;function startrefresh(){xmlhttp=new XMLHttpRequest();xmlhttp.open("POST",http://localhost:8080/myApp/test.jsp,true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.send("name=wk");xmlhttp1.onreadystatechange = function(){if(xmlhttp.readyState == 4)if(xmlhttp.status == 200)document.getElementById("mydvi").innerHTML=xmlhttp.responseText;}}</script>
其中xmlhttp对象是负责客户端和服务器交互的,如果要传递参数要用setRequestHeader方法先,然后用send传入参数
还有,取得xmlhttp.responseText必需经过先前的验证,否则会提示:“完成该操作所需的数据还不可使用”;
如果让这个div自动刷新的话,可以用setInterval('startrefresh()',5000),这个函数的作用是每隔5秒自动执行一次startrefresh方法,还有一种方法是setTimeout('startrefresh()',5000),但是这个方法只会执行一次。
- 局部刷新一个div
- ajax局部刷新一个div下的jsp
- ajax局部刷新一个div下的jsp
- SpringMVC实现局部刷新DIV
- dwz之局部刷新div
- 一个AJAX局部刷新 asp
- Ajax局部刷新div后如何跳出进行全局刷新
- ajax,jquery,$.post/$.get异步刷新div,局部刷新页面
- 一个AJAX局部刷新的例子
- 一个AJAX局部刷新的例子
- jquery ajax配合SpringMVC实现局部刷新DIV
- jquery ajax配合SpringMVC实现局部刷新DIV
- jQuery翻页yunm.pager.js,涉及div局部刷新
- 局部刷新
- 局部刷新
- 局部刷新
- 局部刷新
- 局部刷新
- Fckeditor火狐Firefox javascript获取内容
- PLSQL select into 为空的时候 报错的处理方法
- linux网络命令
- 记录
- ExtJs FormPanel 表单布局
- 局部刷新一个div
- 如何学好Visual C++
- C++求精确的运行时间值
- C++ command model 命令模式
- sql unique约束
- jsJSON对象
- 【黑马程序员】SQL入门(2)MSSQL Server函数
- 判断文件,文件夹是否存在
- Android中shape的使用