Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/413.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.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
Javascript Firefox上的jQuery URL获取错误_Javascript_Jquery_Firefox - Fatal编程技术网

Javascript Firefox上的jQuery URL获取错误

Javascript Firefox上的jQuery URL获取错误,javascript,jquery,firefox,Javascript,Jquery,Firefox,有人能指出为什么我的JavaScript函数属于错误函数而不是成功函数吗?Ubuntu上的Firefox $(document).ready(function() { console.log( "Start" ); $.ajax({ type: "GET", dataType: "html", url: "http://slashdot.org", error: function(request, status) { con

有人能指出为什么我的JavaScript函数属于错误函数而不是成功函数吗?Ubuntu上的Firefox

$(document).ready(function() {
        console.log( "Start" );
        $.ajax({ type: "GET", dataType: "html", url: "http://slashdot.org",
        error: function(request, status) {
            console.log("Error");
        },
        success: function(data) {
            console.log("Sucess");
        }
        });
            console.log( "End" );
        });
由于,您不能对当前网页的域以外的域发出ajax调用

可能的解决方法取决于您的实际问题:

  • 在您的域上构建一个服务器代理,该代理将为您从其他站点获取网页,以便您可以将请求发送到自己的域

  • 使用iframe显示来自另一个域的内容


  • 这是跨域策略的常见问题。如果您使用的是jQueryAjax,那么您可以使用它进行跨域查询。文件位于


    欢迎来到最常见的Javascript问题之一。阅读以下内容:将您的url更改为与为您的页面提供服务的服务器位于同一域中的url。@PbxMan我相信这不会有帮助。他们似乎需要来自不同领域的数据。
     $.ajax({ type: "GET", dataType: "json", url: "https://api.instagram.com/v1/tags/stackoverflow/media/recent?client_id=0324ff3396ef4ab49697505678e734f5&callback=?",
          error: function(request, status) {
               console.log(request, status);
          },
          success: function(data) {
               console.log(data);
          }
     });