Advertisement
andrew35133

My app js

Aug 17th, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Lat and Long Lookup
  2.  
  3.  function gpslookup() {
  4.  navigator.geolocation.getCurrentPosition(onSuccess, onError, { enableHighAccuracy: true });
  5.  }
  6.  
  7.  var latitude = position.coords.latitude;
  8.  var longitude = position.coords.longitude;
  9.  
  10. //Writing Lat and Long to Page
  11.  document.getElementById("latbox").value = latitude;
  12.  document.getElementById("longbox").value = longitude;
  13.  
  14. //Ajax call
  15.  var mapquesturl = http:/\/www.mapquestapi.com/geocoding/v1/reverse?key=YOUR_KEY_HERE
  16.  
  17.   function reverselookup() {
  18.     //httpRequest.onreadystatechange = ReverseLookup;
  19.     httpRequest.open('GET', http:/\/www.mapquestapi.com/geocoding/v1/reverse?key=YOUR_KEY_HERE&renderReverse);
  20.     httpRequest.send(location:{latLng:{lat:latitude,lng:longitude}});
  21.   }
  22.  
  23. //Write Address to page
  24.  
  25.  var address =
  26.  var city =
  27.  var state =
  28.  var zip =
  29.  
  30.  document.getElementById("addressbox").value = address;
  31.  document.getElementById("citybox").value = city;
  32.  document.getElementById("statebox").value = state;
  33.  document.getElementById("zipbox").value = zip;
  34.  
  35. //Maybe repeat function every 5 secs?
  36.  
  37.  do {
  38.   function(gpslookup);
  39.   function(reverselookup);
  40.   setTimeout(function(), 5000);
  41.  }
  42.  while (0<1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement