Javascript creates the sample code for the createXmlHttpRequest object

  • 2020-03-30 01:37:37
  • OfStack


 var xmlHttp;

    function createXmlHttpRequest()
    {
        if(window.XMLHttpRequest)
        {
            xmlHttp=new XMLHttpRequest();

            if(xmlHttp.overrideMimeType)
                {
                    xmlHttp.overrideMimeType("text/xml");
                }
        }
        else if(window.ActiveXObject)
        {
            try
            {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   
            }
            catch(e)
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");   
            }
        }
        if(!xmlHttp)
        {
            window.alert(" Your browser does not support creation XMLhttpRequest object ");
        }
        return xmlHttp;
    }

Related articles: