我正在使用ember-data 2.4.0和ember-ajax 2.0.1,但在使用ie9时遇到了问题。我读到过ie9使用旧的XDomainRequest而不是新的XHR请求,并且它只发送空白或text/plain内容类型。我有一个将ember-data发布到的rails api,它在Chrome、Firefox和ie10+上都工作得很好,但在ie9中,我可以看到有效负载不是用json内容类型发送的,所以服务器只得到一个纯文本字符串,它不会被识别为期望json数据的参数散列。
有人建议我做这样的事情,但这对我不起作用。
export default DS.JSONAPIAdapter.extend({
host: ENV.apiUrl,
ajaxOptions(url, type, hash) {
hash.contentType = 'application/json';
hash.dataType = 'json';
return this._super(url, type, hash);
}
});所有的存储请求都是标准this.store.create('whatever', payload)类型的请求。
ember的文档说它在ember 2+中支持ie9,所以我认为这会开箱即用。我是不是遗漏了什么让它工作的东西?
发布于 2016-05-02 21:48:49
我通过在app/index.html文件中添加此XDomainRequest polyfill https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest修复了此问题。
https://stackoverflow.com/questions/36947002
复制相似问题