I'm trying to make a asynchronous call to a service that returns json using XDomainRequest (IE8). The problem is that i always get an error (the onerror event is fired, and the responseText is always null), i'm using fiddler to check the response of the service and i seems right (I can see the json object returnig), this only happen in IE8 when using XDomainRequest, the same functionality implemented in JQuery works fine.
Any clue would be appreciated. Thanks!
P.S.: This is my javascript code:
.....
if (jQuery.browser.msie && window.XDomainRequest) {
//Use Microsoft XDR
var xdr = new XDomainRequest();
xdr.open("post", url);
xdr.onload = function () {
alert("Loading");
alert(xdr.responseText);
};
xdr.onsuccess = function() {
alert("Success!");
alert(xdr.responseText);
};
xdr.onerror = function() {
alert("Error!");
alert(xdr.responseText);
};
xdr.onprogress = function() {
alert("Progress");
alert(xdr.responseText);
};
xdr.timeout = 1000;
xdr.send("data: " + escape(data));
var response = xdr.responseText;
} else .....