Skip to content

Instantly share code, notes, and snippets.

@juliankrispel
Created November 28, 2012 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliankrispel/4160762 to your computer and use it in GitHub Desktop.
Save juliankrispel/4160762 to your computer and use it in GitHub Desktop.
ie7 cross domain ajax request
if ($.browser.msie && window.XDomainRequest && $.browser.version.toString().indexOf('7') == 0) {
// Use Microsoft XDR
var xdr = new XDomainRequest();
xdr.open("get", url);
xdr.onload = function () {
var JSON = jQuery.parseJSON(xdr.responseText);
if (JSON == null || typeof (JSON) == 'undefined')
{
JSON = jQuery.parseJSON(data.firstChild.textContent);
}
renderCommentCount(JSON);
};
xdr.send();
} else {
jQuery.ajax({
type: 'GET',
url: url,
processData: true,
data: {},
dataType: "json",
success: function (data) { renderCommentCount(data); }
});
}
@kevinhq
Copy link

kevinhq commented Mar 25, 2014

window.XDomainRequest is undefined on IE7 ?

@dschueler
Copy link

I thought XDR was only IE 8 and above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment