一、请求页面
// 页面对应都代码
<html>
…………….
……………
<input id=’input1’ onclick=” CheckValue()” value=’查找’> // 当执行此按钮的时候进行AJAX操作
</html>
// 脚本调用的开始
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实例
var ajaxObj = CreateAjaxObj();
function CreateAjaxObj()
{
var httpRequest = false;
if (window.XMLHttpRequest)
{
httpRequest = new XMLHttpRequest();
if(httpRequest.overrideMimeType)
httpRequest.overrideMimeType('text/xml');
}
else if (window.ActiveXObject)
{