Get client IP address via third party web service

后端 未结 7 1463
一整个雨季
一整个雨季 2020-11-27 19:02

I would like to read my ip address from the following page(http://l2.io/ip or other) using javascript to save him in my variable \"myIp\".

function getMyIP()         


        
相关标签:
7条回答
  • 2020-11-27 19:25
        $.ajax({
            url: '//freegeoip.net/json/',
            type: 'POST',
            dataType: 'jsonp',
            success: function(location) {
                alert(location.ip);
            }
        });
    

    This will work https too

    0 讨论(0)
提交回复
热议问题