Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/417.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 jqueryajax没有';不适用于Firefox(以前的版本也适用),但适用于Chrome_Javascript_Jquery_Ajax_Google Chrome_Firefox - Fatal编程技术网

Javascript jqueryajax没有';不适用于Firefox(以前的版本也适用),但适用于Chrome

Javascript jqueryajax没有';不适用于Firefox(以前的版本也适用),但适用于Chrome,javascript,jquery,ajax,google-chrome,firefox,Javascript,Jquery,Ajax,Google Chrome,Firefox,此简单代码在Chrome(显示您的IP)中有效,但在Firefox中无效。返回以下错误: “发生错误:404错误” $(文档).ready(函数() { $.ajaxSetup({cache:false}); $.ajax({ url:“https://freegeoip.net/json/", 数据类型:“JSONP”, 错误:函数(xhr) { console.log(“发生错误:“+xhr.status+”“+xhr.statusText”); }, 成功:功能(数据) { consol

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

“发生错误:404错误”

$(文档).ready(函数()
{
$.ajaxSetup({cache:false});
$.ajax({
url:“https://freegeoip.net/json/",
数据类型:“JSONP”,
错误:函数(xhr)
{
console.log(“发生错误:“+xhr.status+”“+xhr.statusText”);
}, 
成功:功能(数据)
{
console.log(data.ip);
}
});
});
这是小提琴:


非常感谢您的帮助。

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

案件得到解决

<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>