AJAX - 创建 XMLHttpRequest 对象

 

XMLHttpRequest 对象

所有现代浏览器均支持 XMLHttpRequest 对象。

XMLHttpRequest 用于在后台与服务器交换数据。这意味着可以在不重新加载整个网页的情况下,对网页的某部分进行更新。


创建 XMLHttpRequest 对象

创建 XMLHttpRequest 对象的语法:

variable=new XMLHttpRequest();

实例

var xmlhttp;
if (window.XMLHttpRequest)
{
 xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
posted @ 2017-11-25 20:33  为PG1打call  阅读(121)  评论(0编辑  收藏  举报