TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Find City and Region in Web Application using Lat and Long
Yogesh Sharma
Jan 08
2015
Code
1.1
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
<html xmlns=
"http://www.w3.org/1999/xhtml"
>
<head runat=
"server"
>
<script src=
"JS/jquery-2.1.1.js"
></script>
<title></title>
<script>
function
GetLocation()
{
$.get(
"http://ipinfo.io"
,
function
(response) {
$(
"#ip"
).html(
"IP: "
+ response.ip);
$(
"#address"
).html(
"Location: "
+ response.city +
", "
+ response.region);
$(
"#details"
).html(JSON.stringify(response,
null
, 4));
},
"jsonp"
);
}
</script>
</head>
<body onload=
"GetLocation()"
>
<form id=
"form1"
runat=
"server"
>
<div id=
"ip"
></div>
<div id=
"address"
></div>
<hr/>Full response: <pre id=
"details"
></pre>
</form>
</body>
</html>
JavaScript
Lat
Long