2017-03-18 79 views
1

这个简单的代码在Chrome浏览器(显示你的IP),但不能在Firefox返回以下错误:jQuery的阿贾克斯不会在Firefox(使用以前版本的工作)工作,但在Chrome浏览器的

“发生错误:404错误“。

<script>$(document).ready(function() 
    { 
    $.ajaxSetup({cache: false}); 
    $.ajax({ 
     url: "https://freegeoip.net/json/", 
     dataType: "JSONP", 
     error: function(xhr) 
      { 
      console.log("An error occured: " + xhr.status + " " + xhr.statusText); 
      }, 
     success: function(data) 
      { 
      console.log(data.ip); 
      } 
     }); 
    }); 
</script> 

这里的小提琴:https://jsfiddle.net/7ayo52Lx/5/

任何帮助表示赞赏。

回答

1

好吧,我发现我的愚蠢的错误,也许它会帮助别人:我的addblocker阻止了请求。

案件解决。