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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
samanta
NA
429
135.2k
Get latitude and longitude from Zipcode
Feb 10 2015 8:41 AM
i want fetch latitude and longitude of Zipcode.
i tried like this
<script type="text/javascript">
var geocoder, location1, location2,glatlng1,glatlng2;
var dealerPincodes = ["560042", "560043", "560044", "560054"];
someFunction(dealerPincodes, function() {
// my code
});
function someFunction(dealerPincodes, callback) {
var coords = [];
for(var i = 0; i < dealerPincodes.length; i++) {
alert(dealerPincodes[i]);
Pincode = dealerPincodes[i];
var geocoder = new google.maps.Geocoder();
if (geocoder) {
geocoder.geocode({'address':Pincode}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
coords.push(results[0].geometry.location);
var latitude = results[0].geometry.location.lat();
var longitude = results[0].geometry.location.lng();
alert("Latitude: " + latitude + "\nLongitude: " + longitude);
if(coords.length == dealerPincodes.length) {
if( typeof callback == 'function' ) {
callback();
}
}
}
else {
throw('No results found: ' + status);
}
});
}
}
}
</script>
but its not working properly
Reply
Answers (
0
)
Timezone option values
In bootstrap how tofit Image Automaticaly toAll MobileDevice