D
D
Dmitry2019-11-15 23:31:57
JavaScript
Dmitry, 2019-11-15 23:31:57

Why might xmlhttprequest not work in ie?

Anticipating questions,
yes, there are still retrogrades using the donkey
and it is necessary to maintain accessibility for them too.
Actually, the
xmlhttprequest question is created, it
works out by downloading the necessary data,
but the responsetext is empty
and most importantly, everything is silent without giving any errors,
I’m guessing that this donkey needs
a code ,
although IMHO it is completely standard

function createRequestObject() 
  {
    try { return new XMLHttpRequest() }
    catch(e) 
    {
      try { return new ActiveXObject('Msxml2.XMLHTTP') }
      catch(e) 
      {
        try { return new ActiveXObject('Microsoft.XMLHTTP') }
        catch(e) { return null; }
      }
    }
  }


function test(purl)
{
var http = createRequestObject();
    if( http ) 
    {
      http.open('get', purl);
      http.onreadystatechange = function () 
      {
        if(http.readyState == 4) 
        {console.log(http.responseText);
        }
      }
      http.send(null);    
    }
    else 
    {
      document.location = link;
    }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question