Created
November 28, 2012 12:07
-
-
Save juliankrispel/4160762 to your computer and use it in GitHub Desktop.
ie7 cross domain ajax request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); } | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I thought XDR was only IE 8 and above