Javascript jqueryajax没有';不适用于Firefox(以前的版本也适用),但适用于Chrome
此简单代码在Chrome(显示您的IP)中有效,但在Firefox中无效。返回以下错误: “发生错误:404错误”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
$(文档).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>