I have a problem when trying to get JSON data with Ajax and on Internet Explorer only.
I'm using this jQuery code :
$.ajax({
type: "GET",
url: "./ajaxglobal/chargementcommandes",
cache: false,
dataType: "json",
contentType: "application/json",
success: function(data) {
alert("Success : "+data);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("Error : "+textStatus+" / "+errorThrown);
}
});
With "chargementcommandes" being a PHP/Zend page.
The PHP code of "chargementcommandes", simplified for testing, is the following :
echo '[
{ "data" : "A node", "children" : [ { "data" : "Only child", "state" : "closed" } ], "state" : "open" },
"Ajax node"
]';
Everything is working fine in Firefox and Chrome (I get the expected data), but in Internet Explorer (tested in IE8 and IE9), I get "Success : undefined" from the alert. So the Ajax call doesn't return anything. I tried many things but I didn't succeed to get rid of this issue.
Any help would be greatly appreciated. Thanks in advance !
EDIT : Added type, cache and contenttype in jQuery code. Still "Success : undefined" response...