【问题标题】:Jquery Ajax doesn't work in Firefox (used to work in previous versions) but works in ChromeJquery Ajax 不能在 Firefox 中工作(以前在以前的版本中工作)但在 Chrome 中工作
【发布时间】:2017-03-18 12:53:11
【问题描述】:

这个简单的代码在 Chrome 中有效(显示您的 IP)但在 Firefox 中无效,返回以下错误:

“发生错误: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/

感谢任何帮助。

【问题讨论】:

    标签: javascript jquery ajax google-chrome firefox


    【解决方案1】:

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

    案件已解决。

    【讨论】:

      猜你喜欢
      • 2012-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-12
      • 1970-01-01
      • 2011-03-03
      • 1970-01-01
      • 2014-02-15
      相关资源
      最近更新 更多