Some IE9 Grief!

An AJAX call that worked everywhere except IE9, and the console.log behind it.

From the archive. First published on the Programming Recipes blog on 25 October 2012. Kept as it was written, so details may have moved on since.

OriginalArchived copy

Today I really hated IE9 even more!

I had this ajax:

$.ajax({
type: "GET",
url: "Reportviewer.aspx/GetSomeData",
contentType: "application/json; charset=utf-8",
data: "{}",
dataType: "json",
success: AjaxSucceeded
});
function AjaxSucceeded(result) {
console.log(result)
$(result.d).each(function () {
...
});
}

In IE9 the ajax just don’t want to call the success function “AjaxSucceeded” but in Crome, Firefox it returns just fine.

After googeling like crazy I found out all instances of console.log() need to be removed from your script in order for it to work in IE9 without it being in developer mode.

Well now I know!