I have a problem ... I am using jQuery ajax to call a web service that returns XML. JQuery ajax stuff works amazingly for every browser except i.e.
So, for browsers, I use XDomainRequest. Here is the code:
if ($.browser.msie && window.XDomainRequest) {
var xdr = new XDomainRequest();
xdr.open("get", theUserUrl);
xdr.timeout = 95000;
xdr.onerror = function () {
console.log('we have an error!');
}
xdr.onprogress = function () {
console.log('this sucks!');
};
xdr.ontimeout = function () {
console.log('it timed out!');
};
xdr.onopen = function () {
console.log('we open the xdomainrequest');
};
xdr.onload = function () {
var xml2 = new ActiveXObject("Microsoft.XMLDOM");
xml2.async = false;
xml2.loadXML(xdr.responseText);
console.log('do we get any response text at all?: ' + xdr.responseText);
ParseOwnershipObjects(xml2);
};
xdr.send();
}
This exact code works fine elsewhere in the application using a different URL.
The url is ok, it returns exactly what it should in the browser (and therefore why jquery ajax call works). A couple of things to note:
I am integrating my own html / javascript with another guy asp.net project.
In the file global.asax.csI have:
protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET,OPTIONS");
}
therefore, I do not think this is a header problem.
None of my handlers fire. Not onprogress, ontimeout, onerror ... nothing! I don’t have time to convert web service to JSON.
?
!