//document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
//responseXML 以 XML 返回响应
//服务器端ContentType 属性为 response 对象设置了 HTTP 内容类型。该属性的默认值是 "text/html"。服务器端返回responseXML 要把内容类型设置为 XML。
var xmlDoc=xmlHttp.responseXML.documentElement;
document.getElementById("companyname").innerHTML=
xmlDoc.getElementsByTagName("compname")[0].childNodes[0].nodeValue;
document.getElementById("contactname").innerHTML=
xmlDoc.getElementsByTagName("contname")[0].childNodes[0].nodeValue;
document.getElementById("address").innerHTML=
xmlDoc.getElementsByTagName("address")[0].childNodes[0].nodeValue;
document.getElementById("city").innerHTML=
xmlDoc.getElementsByTagName("city")[0].childNodes[0].nodeValue;
document.getElementById("country").innerHTML=
xmlDoc.getElementsByTagName("country")[0].childNodes[0].nodeValue;
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
三.Ajax框架:基于浏览器的应用框架,基于服务器端的应用框架。
1.基于浏览器的应用框架一般分为两种:
Aplication frameworks:提供了浏览器功能,但其最著名的还是在于通过窗口生成组件建立桌面GUI。 如:DOJO,qooxdoo,JavaFX,YUI,ExtJS(最开始的名字是yui-ext,因为扩展了yui的库,后来发展为可选择扩展jquery和prototype就改名字为ext),Flex(与ExtJS有很多相似),TIBET等。
Infrastructural frameworks:提供基本的框架功能和轻便式浏览器端操作,让开发者去创建具体应用,主要功能包括:
-
基于XMLHttpRequest组件的浏览器交互功能
XML解析和操作功能
根据XMLHttpRequest的返回信息进行相应的DOM操作
一些特殊情况下,和其他的浏览器端技术如Flash(或Java Applets)等集合到一起应用









