JQuery的外部Ajax调用不工作在IE浏览器 [英] JQuery external Ajax call not working in IE

查看:261
本文介绍了JQuery的外部Ajax调用不工作在IE浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发送一些数据到外部URL的AJAX脚本。外部URL托管在同一台服务器上,但该域比Ajax调用的来源不同。

I have an ajax script that sends some data to an external URL. The external URL is hosted on the same server, however the domain is different than the source of the ajax call.

这是工作完全在Firefox和Chrome。然而,在IE浏览器的AJAX调用不通过,并返回FALSE功能没有任何工作(一旦AJAX调用失败)

This is working perfectly in Firefox and Chrome. However in IE The ajax call does not go through, and the Return False function does not either work (once the ajax call fails).

下面是我的code:

 $.get('http://myexternaldomian.com/feedback/save.php', {
            answer: $('#answer').val(),
            page_url: pathname
        });

        // Keeps the user on the page
        return false;

当我尝试删除HTTP://从阿贾克斯URL,返回虚假不工作

When I try removing the http:// from the ajax url, the return false does work.

在这个任何帮助将是很大的AP preciated。谢谢

Any help on this would be greatly appreciated. Thank You

推荐答案

我很惊讶,其中的任何工作。一般的浏览器AJAX调用到一台当前页面来自其他域不允许。

I'm surprised any of them are working. Browsers generally don't allow ajax calls to a domain other than the one the current page came from.

主要的例外是,如果您用JSONP(JSON与填充)Ajax调用。你可以使用jQuery做到这一点,这里是如何。看的dataType 选项下。

The main exception to this rule is if you make an ajax call using jsonp (json with padding). You can do this with jQuery, here's how. Look under the dataType option.

这篇关于JQuery的外部Ajax调用不工作在IE浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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