We've encountered an odd problem with a $.getJSON call which only seems to affect older versions of IE. Code is as follows:
var success = function (response) {
// do stuff
}
$.getJSON(url, success);
Under Chrome, Firefox, IE10, this code works just fine - getJSON hits the URL (which is valid, and is not cross domain), returns 200 OK and returns the data, which is passed through to the success function as you'd expect.
However under IE9 and below, the success callback is invoked but the response parameter passed through is undefined. By capturing the network traffic in IE Dev Tools I can see the call hitting the URL, returning 200 OK and returning valid JSON in the response body. So why is this coming out as undefined when it hits the success callback?
I've tried using the $.ajax call instead with appropriate parameters, and I see the same behaviour. Code below:
$.ajax({
dataType: "json",
url: url,
success: success
};
We're using jQuery 1.7.2 (one of the libraries we've got on the page is broken under the newer version of jQuery, hence the old version).
EDIT: Just tried updating the page to use jQuery 1.10.1, doesn't fix the issue.
EDIT 2: I've confirmed that the JSON data being returned is valid via jsonlint.com so that isn't the issue either.