0

I have an ajax request

$.ajax({
   type: "GET",
   url: url,
   success: function(xml) {
        $('.post-msg').append(processXml(xml, config));
   },
   error: function(jqXhr, textStatus, errorThrown) {
       var errorMsg = "Request on url: " + url + " failed: " + textStatus + " error:" + errorThrown;
            alert(errorMsg);
        }
    });

The problem is that it does not work in IE 8,9 and boss proposed using post message. What are the ways to make this request worked in IE 8,9 ?

Geray Suinov
  • 3,521
  • 3
  • 16
  • 19

1 Answers1

2

How to do cross domain requests for CORS-enabled websites in IE8/9 is talked about here, basically involves using IE-unique object XDomainRequest instead of XMLHttpRequest.

You can see a code example on the msdn XDomainRequest page

// 1. Create XDR object 
var xdr = new XDomainRequest(); 
// 2. Open connection with server using GET method
xdr.open("get", "http://www.contoso.com/xdr.aspx");
// 3. Send string data to server
xdr.send(); 
Paul S.
  • 64,864
  • 9
  • 122
  • 138