Mike.M
Mike.M

Reputation: 150

Jquery Ajax doesn't work in Firefox (used to work in previous versions) but works in Chrome

This simple code works in Chrome (displays your IP) but not in Firefox returns the following error :

"An error occured: 404 error".

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

Here's the fiddle: https://jsfiddle.net/7ayo52Lx/5/

Any help is appreciated.

Upvotes: 1

Views: 162

Answers (1)

Mike.M
Mike.M

Reputation: 150

OK, I found my stupid mistake and maybe it will help others: My addblocker blocked the request.

Case solved.

Upvotes: 1

Related Questions