0

我有ajax跨域请求。

 $.ajax({
        type: "GET",
        url: url,
        success: function(xml) {
            $('.post-msg').append(processXml(xml, config));
        },
        error: function(jqXhr, textStatus, errorThrown) {
            var errorMsg = "Request on url: " + url + " failed: " + textStatus + " error:" + errorThrown;
            alert(errorMsg);
        }
    });

我需要使用 Postmessage 技术(https://github.com/daepark/postmessage)“转换”它。早些时候我没有处理过这样的事情。

4

1 回答 1

0

但它不适用于 IE < 10。我需要使用技术 POST 消息“转换”它。早些时候我没有处理过这样的事情。

这是两个完全独立且不相关的东西。

它在 IE < 10 中不起作用的原因是 IE < 10不支持XMLHttpRequest带有 jQ​​uery用来提供ajax函数的标准对象的 CORS 。IE8 和 IE9确实支持CORS,但仅支持 Microsoft 特定XDomainRequest对象而不是XMLHttpRequest. jQuery 不提供这种跨浏览器行为(请参阅jQuery 问题跟踪器中的这个问题)。根据那张票,至少有一个可用的插件。

至于将其从 a 更改GET为 a POST,这实际上只是在更改

type: "GET",

type: "POST",

但同样,它与 IE 问题无关。

于 2013-07-08T15:41:25.077 回答