jQuery.ajax() - 在IE9返回不确定的数据 [英] jQuery.ajax() - undefined data returned in IE9
问题描述
我有一个非常简单的code:
$。阿贾克斯({
缓存:假的,
数据类型:HTML,
完成:功能(jqXHR){
执行console.log(jqXHR.responseText);
},
成功:功能(数据){
的console.log(数据);
},
网址:http://follows.pl/pages/ajaxtest
});
返回在FF,Chrome和IE8的一些文字,但在IE9它显示了两次不确定。
我已经研究过的开发工具在IE9中,它呈现出正常的响应所以请求工作正常,反应是好的,但变量是不确定的。
响应报头:
响应HTTP / 1.1 200 OK
缓存控制无缓存
内容类型text / html;字符集:UTF-8
语用无缓存
响应
串(4)测试
我怀疑这是你的问题:
内容类型text / html;字符集:UTF-8
该值的格式不正确(在':'之后的字符集是错误的)和IE9不喜欢,只是默默地失败而不是说一些有用的东西。试试这个:
的Content-Type:text / html的;字符集= UTF-8
i have a very simple code:
$.ajax({
cache: false,
dataType: 'html',
complete: function(jqXHR){
console.log(jqXHR.responseText);
},
success: function(data){
console.log(data);
},
url: 'http://follows.pl/pages/ajaxtest'
});
it returns some text in ff, chrome and IE8, but in IE9 it shows twice "undefined".
I've looked into developer tool in IE9, and it showing a normal response so the request works fine, response is fine, but variables are undefined
headers of response:
Response HTTP/1.1 200 OK
Cache-Control no-cache
Content-Type text/html; charset: UTF-8
Pragma no-cache
response
string(4) "test"
I suspect this is your problem:
Content-Type text/html; charset: UTF-8
That value is not correctly formatted (the ':' after charset is wrong) and IE9 doesn't like it, but silently fails instead of saying something useful. Try this:
Content-Type: text/html;charset=utf-8
这篇关于jQuery.ajax() - 在IE9返回不确定的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!