When calling specific service with ajax call IE9 returns "undefined":
$.ajax({
url: URL_PATH,
type: "get",
success: function(data) {
console.log(data);
}
});
Inspecting same code in Firefox, Chrome, IE10+, it works. I even tried adding:
contentType: "application/json; charset=utf-8",
datatype: "json",
to ajax call properties, but no luck.
Strange thing is that when I call a local JSON file, everything is okay in IE9, but when returning from local server url (information from database) that error occurs. Taking a look at response body, I got well formatted json string.
UPDATE: Also added the error catching block:
error: function(XMLHttpRequest)
{
console.log(XMLHttpRequest);
},
but no luck, it doesn't go inside the error block, it catches "success"
there are 3 ways to solve this issue,
First one add following lines,
Second one,
solve it by using dataType='jsonp' at the place of dataType='json'
I found a problem. The response header of my rest service was set to charset=UTF8 and the IE couldn't recognize that while other browsers work with no problem, the correct spelling needs to be UTF-8 with a dash :) a rookie mistake. Thanks everyone for suggestions. Closing this thread now.