我正在尝试将REST Web服务中的数据感染到HTML页面中。问题是Internet Explorer 6(这是我在XP SP3上的目标工作站)在努力工作。 这是使用的代码:
$.ajax({
type: "GET",contentType:"application/json; charset=utf-8",dataType : 'json',url: "https://jsonplaceholder.typicode.com/posts/1",success: function(data) {
alert(data);
},complete: function(xhr) {
alert(xhr.status+" "+xhr.responseText);
}
});
在Firefox 52 ESR上进行了测试:成功和完整的功能都可以工作。
在Chrome 49上:成功工作,调用complete,但xhr.status为0且xhr.responseText为空。
在IE6上,根本不调用成功,而是调用complete,但是xhr.status为0,xhr.responseText未定义。
尝试了SOF此处已回答的问题,例如删除了多余的逗号,添加了dataType ...,但IE6仍然没有成功。
我们怎么能一次做到呢?
谢谢