Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery.get未接收数据_Jquery_Ruby On Rails_Rest - Fatal编程技术网

jQuery.get未接收数据

jQuery.get未接收数据,jquery,ruby-on-rails,rest,Jquery,Ruby On Rails,Rest,我有以下html+jquery: <body> <head> <script type="text/javascript" src="jquery.js"></script> <script> $(window).load(function() { $('#test').bind('click', functi

我有以下html+jquery:

<body>
    <head>
            <script type="text/javascript" src="jquery.js"></script>
            <script>
                $(window).load(function() {
                    $('#test').bind('click', function() {
                        $.get("http://localhost:3000/promotions.xml", function(data){
                            alert("Data Loaded: " + data);
                        });                        
                    });                 
                });
            </script>
    </head>

    <input id="test" type="button" value="Testando">
</body>

所以我想我缺少的是javascript/jQuery中的一些东西。我正在使用jquery1.4.4。出什么问题了?

我猜这是由于,这要求AJAX请求与页面的源位置相同

如果页面不是从
localhost:3000
托管的,则会违反策略

如果您正在使用Chrome进行测试,您应该能够通过以下方式从终端应用程序启动安全策略来禁用安全策略:

--disable-web-security
--disable-web-security