In ie 9, two parameters come to the success method: textStatus and XMLHttpRequest . Data always undefined . In all other browsers, the code works fine and 3 parameters come in success. As a result, I can not process any ajax request after it has been executed. What could be the problem?

Here is part of the method code:

 SendAjax = function(async, type, act, t, datas) { var datatype = 'html'; if (type=='reload_weather' || type=='popup' || act == 'set_location') datatype = 'json'; var result = 0; $.ajax({ url: '_ajax/', data: {act:act, type:type, datas:datas}, type: "POST", dataType: datatype, cache: false, async: async, success: function(data, textStatus, XMLHttpRequest) { printArray(arguments); /* { "1": "success", "2": { "readyState": 4, "status": 200, "statusText": "OK" } } */ printArray(data); /* undefined */ } } } 

The Ajax request receives the data and the response text in the debugger ie I can see. There is what I need. But how can I process them in code and why they do not appear in the method of success?

UPDATE: the problem is solved by adding the following lines to the php file where the request is sent:

 header('Content-type: text/html; charset=utf-8'); 
  • printArray () is what? can it matter? for example there are no thread methods Array.prototype? - zb '
  • Show the code for the printArray method. - RubaXa
  • The problem is not in it. This is just console output. Under the method, I indicated that it displays. function printArray (array) {console.log (JSON.stringify (array, null, 4)); }. I can also see the result of the query in Fiddler. There are always answer texts. In ie7 and 8 also does not work, data and accordingly responseText are always undefined. In Chrome, Safari, Opera, FF, everything works ... - 7R41N33
  • Try sticking the debugger into success and running through the stack upwards, maybe you will see something. - RubaXa

0