Jump to content

Akilian

Members
  • Content Count

    13
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Akilian

  • Rank
    Newbie
  1. Based on my code, is there a way to limit the calls to one call per hour?
  2. What is var options = {timeout:60000}; for?
  3. It's working now. it was xmlHttp.send(); in the wrong place. Thank you so much for your help. I remember why I liked to do this years ago.
  4. Will do. I'll let you know what I come up with.
  5. Well, I got the alerts to display, but still no weather. function showLocation(position) { var xmlHttp = new XMLHttpRequest(), latitude = position.coords.latitude, longitude = position.coords.longitude, weatherInform, elWeatherIcon = document.querySelector("#weather-icon"), elWeatherTemp = document.querySelector("#weather-temp"), elWeatherMax = document.querySelector("#weather-max"), elWeatherMin = document.querySelector("#weather-min"), elWeat
  6. It did work when the showPosition was out of the weather function. I'll have to troubleshoot. Thanks for your help.
  7. I dont think that its getting the coords. When I alert(position.coords.latitude + "," + position.coords.longitude); nothing happens.
  8. URL_WEATHER_DATA = "https://api.darksky.net/forecast/gfgdfgsdgfsghsrtghshgh/" Gibberish is my api. This works if I manually plug in the coordinates. xmlHttp.open("GET", URL_WEATHER_DATA + "30,-90" + "?exclude=hourly,minutely,alerts,flags?units=auto",false);
  9. I'm starting to understand but I'm having issues with the url. if(navigator.geolocation){ // timeout at 60000 milliseconds (60 seconds) var options = {timeout:60000}; navigator.geolocation.getCurrentPosition(updateWeather, errorHandler, options); } else{ alert("Sorry, browser does not support geolocation!"); } } function updateWeather(position) { var coords = document.getElementById(); coords.innerHTML = position.coords.latitude + "," + position.coords.longitude; xmlHtt
  10. Is this right? var x = document.getElementById("demo"); function showLocation(position) { var latitude = position.coords.latitude; var longitude = position.coords.longitude; x.innerHTML = latitude + "," + longitude; navigator.geolocation.getCurrentPosition(updateWeather, errorHandler); } function errorHandler(err) { if(err.code === 1) { alert("Error: Access is denied!"); } else if( err.code === 2) { alert("Error: Position is unavailable!"); } } funct
  11. Would you mind showing me? I would be grateful.
  12. Yes, I have read those. i can get the coordinates to send via alert but cannot link it with the weather function. What should I put for location so it calls for the coordinates. And, thank you both for the assistance.
  13. My weather function works when I enter the coordinates myself. I'm trying to use a get location function to find and enter them in but it's not working. Please help. //////////////////////////////////////////////////////////////////////////////////////////////// var x = document.getElementById("demo"); function showLocation(position) { var latitude = position.coords.latitude; var longitude = position.coords.longitude; x.innerHTML = latitude + "," + longitude; } function errorHandler(err) { if(err.code === 1) { alert("Error:
×
×
  • Create New...