Guest User

Untitled

a guest
May 20th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. if (navigator.geolocation) {
  2. navigator.geolocation.getCurrentPosition(
  3. function (position) {
  4. $.ajax({
  5. url: "/WeatherApplication/CurrentPositionWeather",
  6. type: "POST",
  7. data: { myLongitude: position.coords.longitude, myLatitude: position.coords.latitude },
  8. success: function (data) { $("#weatherForecasts").replaceWith(data); }
  9.  
  10. });
  11. }, function (error) {
  12. //alert("Error occurred. Error code:" + error.code);
  13. //the errorcode can be:
  14. //0: unknown error
  15. //1: permission denied
  16. //2: position unavailable (error response from location provider)
  17. //3: timed out
  18. }
  19. );
  20. }
Add Comment
Please, Sign In to add comment