角JS $ http请求没有到达在IE8服务器 [英] Angular JS $http request does not reach the server in ie8

查看:434
本文介绍了角JS $ http请求没有到达在IE8服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用HTTP $ IE8的问题。请求不会到达服务器,直到我打刷新。说回相同的链接仍然有同样的问题,直到我打再次刷新。

I'm having issues with using $http on ie8. The request does not reach the server, until I hit a refresh. Coming back to the same link still has the same problem until I hit refresh again.

奇怪的是,如果Web服务器是局域网和请求在局域网的服务器做,它工作正常。但是,如果网络服务器远程托管,这是行不通的!

The weird thing is if the web server is on LAN and the request is made to a server in LAN, it works fine. But if the webserver is hosted remotely, it does not work!

下面是code:

的index.html

{{test}}

控制器

app.controller(
    "TestController",
    function( $scope, $http) {
        var url = '/test/get_data';
        $http.get(url).success(function(data) {
            $scope.test = data;
        });
    }
);

我得到这个错误:类型错误:对象不支持此属性或methodundefined

我prepared一个较早的jsfiddle,但被的jsfiddle在IE8打破所以这里我就不提供了。

I prepared a JSFiddle earlier but JSFiddle is broken in ie8 so I don't provide it here.

不幸的是,我没有,我可以跟大家分享一个远程服务器。

Unfortunately I don't have a remote server that I can share with you.

修改
previously我用作下面的一个答复中提到这给了我拒绝访问错误,因为同源策略的,即外部URL。但是,这不是我的问题。我仍然有当请求来自同一产地上述问题

Edit Previously I used an external url which gave me 'Access Denied' error in ie because of Same Origin Policy as mentioned by one answer below. But this was not my original problem. I still have the issue above when request is from the same origin

推荐答案

于是我找到了修复...希望这可以帮助那里的人遇到此问题

So I found the fix... Hope this helps anyone out there that experience this problem


  1. 角脚本需要的jQuery后装载。我没有这一点,因为我使用自动加载jQuery和角Yii框架jQuery的后未包括在内。

  2. 所有控制器的功能必须是在主体部分(刚刚闭幕前)
  3. 的结束
  4. 更新到1.0.5角度似乎解决这​​个问题。在1.0.4发生上述所有技巧的问题。我认为,解决 791804bd
  5. 有关
  1. Angular script needs to be loaded after jQuery. I didn't have this because Yii framework that I use autoloads jQuery and the angular was not included after the jQuery.
  2. All the controller functions need to be at the end of body section (just before the closing )
  3. Updating to angular 1.0.5 seems to fix the problem. The problem occurred in 1.0.4 with all the above tricks. I think is related to fix 791804bd

这篇关于角JS $ http请求没有到达在IE8服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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