AJAX跨域请求IE 8+ [英] AJAX cross-domain request IE 8+

查看:149
本文介绍了AJAX跨域请求IE 8+的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何正确重写Ajax请求,使其在IE 8 +配合使用,XDomainRequest?

  $。阿贾克斯({
    键入:GET,
    网址:网址,
    成功:函数(XML){
        $('。后味精)追加(的processXML(XML,配置));
    },
    错误:函数(jqXhr,textStatus,errorThrown){
        VAR ERRORMSG =的URL请求:+网址+失败:+ textStatus +错误:+ errorThrown;
        警报(ERRORMSG);
    }
});
 

解决方案

使用此插件IE8-9 Xdomain支持。

<一个href="https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest">https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest

How to correct rewrite the Ajax request to make it work in IE 8 +, using XDomainRequest?

$.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);
    }
});

解决方案

Use this plugin for IE8-9 Xdomain support.

https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest

这篇关于AJAX跨域请求IE 8+的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆