封装XHR对象
来源:互联网 发布:前端的业务逻辑js代码 编辑:程序博客网 时间:2024/05/22 08:10
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>封装XHR对象</title>
</head>
<body>
<script>
function getXhr() {
// 声明XMLHttpRequest对象
var xhr = null;
// 根据浏览器的不同情况进行创建
if (window.XMLHttpRequest) {
// 表示除IE外的其他浏览器
xhr = new XMLHttpRequest();
} else {
// 表示IE浏览器
xhr = new ActiveXObject('Microsoft.XMLHttp');
}
return xhr;
}
// 创建核心对象
var xhr = getXhr();
</script>
</body>
</html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>封装XHR对象</title>
</head>
<body>
<script>
function getXhr() {
// 声明XMLHttpRequest对象
var xhr = null;
// 根据浏览器的不同情况进行创建
if (window.XMLHttpRequest) {
// 表示除IE外的其他浏览器
xhr = new XMLHttpRequest();
} else {
// 表示IE浏览器
xhr = new ActiveXObject('Microsoft.XMLHttp');
}
return xhr;
}
// 创建核心对象
var xhr = getXhr();
</script>
</body>
</html>
阅读全文
0 0
- 封装XHR对象
- 获取XHR对象
- ajax-XHR对象
- XHR----XMLHttpRequest对象
- AJAX / XHR :XMLHttpRequest对象
- AJAX--XHR对象
- 原生XHR对象
- AJAX--XHR对象
- XHR——XMLHttpRequest对象
- XHR——XMLHttpRequest对象
- XHR——XMLHttpRequest对象
- Ajax 详解 (1) :XHR 对象
- XHR——XMLHttpRequest对象
- AJAX中xhr对象详解
- XHR对象的get请求
- XHR——XMLHttpRequest对象
- XHR——XMLHttpRequest对象
- readyState xhr对象当前状态
- Math.random()函数生成n到m间的随机数字
- nodelet
- 关于CGLIB 和 PROXY 的两个小例子
- java 发起http请求
- oracle字符类型时间转换 ORA-01843 无效的月份
- 封装XHR对象
- 据说家长们被这道小学数学题套路到哭!你的答案是_____
- 无法解决R_AARCH64_ADR_PREL_PG_HI21重定向于符号__stack_chk_guard@GLIBC_2.17
- ScheduleThreadPoolExecutor的工作原理与使用示例
- QT中生成字符串md5的方法
- Android:Java Coding Guidelines插件的使用(Mac系统)
- c++中的强制类型转换
- 使用Zuul构建API Gateway
- Android四大组件之内容提供者Content Provider总结