98
rated 0 times
[
99]
[
1]
/ answers: 1 / hits: 6481
/ 10 Years ago, fri, february 21, 2014, 12:00:00
i have a question.
i want perline IP address show country use http://ipinfo.io
this html code
<span>192.110.160.11</span><br>
<span>177.67.82.22</span><br>
<span>36.75.102.33</span><br>
my js
document.body.innerHTML = document.body.innerHTML.replace(new RegExp(<span>(.*?)</span>, g),<span id='ip'>$1</span> - <span id='country'>wait..</span>);
var ip = document.getElementById(ip).innerHTML;
$.get(http://ipinfo.io/+ip, function (response) {
$(#country).html(response.country);
}, jsonp);
result my js , http://jsfiddle.net/p26uE
192.110.160.11 - US
177.67.82.22 - wait..
36.75.102.33 - wait..
i want result
192.110.160.11 - US
177.67.82.22 - BR
36.75.102.33 - ID
Thanks for everybody who can help me :D
More From » jquery