Skip to content

Instantly share code, notes, and snippets.

@Padilo300
Created July 26, 2018 07:14
Show Gist options
  • Save Padilo300/d897a72739c4e1c6f51452151a4be9f8 to your computer and use it in GitHub Desktop.
Save Padilo300/d897a72739c4e1c6f51452151a4be9f8 to your computer and use it in GitHub Desktop.
API myIP
function find_my_ip(){
$.ajax({
url: 'https://api.2ip.ua/geo.json',
type: 'post',
data: '',
dataType: 'json',
success: function(json) {
if(json['region'] == 'Dnipropetrovska oblast'){
$('#dnipro_true').css({'display': 'block','opacity': '1'});
}else{
$('#dnipro_false').css({'display': 'block','opacity': '1'});
}
},
error: function () {
$('#dnipro_false').css({'display': 'block','opacity': '1'});
},
});
}
find_my_ip();
@Padilo300
Copy link
Author

отправляем с клиента.
Ограничение 100 запросов с одного ip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment