Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Lat and Long Lookup
- function gpslookup() {
- navigator.geolocation.getCurrentPosition(onSuccess, onError, { enableHighAccuracy: true });
- }
- var latitude = position.coords.latitude;
- var longitude = position.coords.longitude;
- //Writing Lat and Long to Page
- document.getElementById("latbox").value = latitude;
- document.getElementById("longbox").value = longitude;
- //Ajax call
- var mapquesturl = http:/\/www.mapquestapi.com/geocoding/v1/reverse?key=YOUR_KEY_HERE
- function reverselookup() {
- //httpRequest.onreadystatechange = ReverseLookup;
- httpRequest.open('GET', http:/\/www.mapquestapi.com/geocoding/v1/reverse?key=YOUR_KEY_HERE&renderReverse);
- httpRequest.send(location:{latLng:{lat:latitude,lng:longitude}});
- }
- //Write Address to page
- var address =
- var city =
- var state =
- var zip =
- document.getElementById("addressbox").value = address;
- document.getElementById("citybox").value = city;
- document.getElementById("statebox").value = state;
- document.getElementById("zipbox").value = zip;
- //Maybe repeat function every 5 secs?
- do {
- function(gpslookup);
- function(reverselookup);
- setTimeout(function(), 5000);
- }
- while (0<1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement