XMLHttpRequest对象初始化;
<script language=”javascript>
Var http_request =false;
//IE浏览器
http_requesr=new ActiveXObject(“Msxml2.XMLHTTP”);
http_requesr=new ActiveXObject(“Microsoft.XMLHTTP”);
//Mozilla浏览器
http_request=new XMLHttpRequest();
</script>
XMLHttpRequest对象的方法
|
方法 |
描述 |
|
abort() |
停止当前请求 |
|
getAllResponseHeaders() |
作为字符串返回完整的headers |
|
getResponseHeader(“headerLabel”) |
做为字符串返回单个的header标签 |
|
open(“method”,”URL”,”[,asyncFlag[,”userName”[,”password”]]]”) |
设置未决的请求的目标URL,方法,其它参数 |
|
send(content) |
发送请求 |
|
setRequestHeader(“label”,”value”) |
设置header并和请求一起发送 |
XMLHttpRequest对象的属性
|
属性 |
描述 |
|
onreadystatechange |
状态改变的事件触发器 |
|
readyState |
对象状态(integer): 0=未初始化 1=读取中 2=已读取 3=交互中 4=完成 |
|
responsText |
服务器进程返回数据的文本版本 |
|
responseXML |
服务器进程返回数据的兼容DOM的XML文档对象 |
|
status |
服务器返回的状态码,如:404=”未找到文件”、200=”成功” |
|
statusText |
服务器返回到状态文本信息 |


浙公网安备 33010602011771号