ajax|request|xml|xmlhttprequest|创建
以下就是创建XMLHttpRequest完整版的代码,希望对大家有用~
function createXMLHttpRequest()
{
if(window.ActiveXObject)
{
try {
xmlHttpRequest = new ActiveXObject("Msxml3.XMLHTTP");
} catch (e) {
try {
xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}}}
}else if(window.XMLHttpRequest)
{
xmlHttpRequest=new XMLHttpRequest();
if (xmlHttpRequest.overrideMimeType)
xmlHttpRequest.overrideMimeType('text/xml');
}
}