ie8 的 ajax 无效

<script type="text/javascript">
        jQuery.support.cors = true;
</script>

我这边出现的情况是,我调用的是外部接口,所以IE8需要+上这个,允许AJAX跨域请求

另外,web.Config中补充允许跨域

<system.webServer> 
<httpProtocol> 
<customHeaders> 
<add name="Access-Control-Allow-Methods" value="OPTIONS,POST,GET"/> 
<add name="Access-Control-Allow-Headers" value="x-requested-with"/> 
<add name="Access-Control-Allow-Origin" value="*" /> 
</customHeaders> 
</httpProtocol> 
</system.webServer>

 

 补充:Google Chrome 浏览器  默认是禁止 跨域的

可以右击 谷歌浏览器图标->属性,在里面加入

在之前版本的谷歌浏览器中使用 --args --disable-web-security
2016年3月之后的新版本需要使用 --args --disable-web-security --user-data-dir

感谢:http://blog.csdn.net/cuihailiang/article/details/53855972

http://www.cnblogs.com/soonqian/p/6548118.html

 

posted @ 2017-06-28 19:17  蜗牛的礼物  阅读(154)  评论(0编辑  收藏  举报