Note that there are some explanatory texts on larger screens.

plurals
  1. POWeather Underground 10Day Forecast API
    primarykey
    data
    text
    <p>I'm trying to get a 10day forecast in my loaded10DayForcast function below but I'm getting the following error: </p> <pre><code>Cannot read property 'simpleforecast' of undefined </code></pre> <p>Seems like I don't know the correct api call based from this: <a href="http://www.wunderground.com/weather/api/d/docs?d=data/forecast10day" rel="nofollow">http://www.wunderground.com/weather/api/d/docs?d=data/forecast10day</a></p> <p>Which is weird since I'm able to get the current conditions to be displayed correctly.</p> <pre><code> //Get the current weather conditions function getCurrentConditions(text) { console.log("\n") var doc = new XMLHttpRequest(); doc.onreadystatechange = function() { if (doc.readyState == XMLHttpRequest.DONE) { var jsonObject = eval('(' + doc.responseText + ')'); loadedCurrentConditions(jsonObject); } } doc.open("GET", "http://api.wunderground.com/api/KEY/forecast/geolookup/conditions/q/"+ text + ".json"); doc.send(); } //Get the 10 Day Forcast function get10DayForcast(text) { console.log("\n") var doc = new XMLHttpRequest(); doc.onreadystatechange = function() { if (doc.readyState == XMLHttpRequest.DONE) { var jsonObject = eval('(' + doc.responseText + ')'); loaded10DayForcast(jsonObject); } } doc.open("GET", "http://api.wunderground.com/api/KEY/forecast10day/q"+ text + ".json"); doc.send(); } //Display to console function showRequestInfo(text) { console.log(text) } function loadedCurrentConditions(jsonObject) { showRequestInfo("Current Temp F:" + jsonObject.current_observation.temp_f); showRequestInfo("Weather Description:" + jsonObject.current_observation.weather); showRequestInfo("Icon:" + jsonObject.current_observation.icon); } function loaded10DayForcast(jsonObject) { showRequestInfo("Today High Temp F:" + jsonObject.forecast.simpleforecast.forecastday.Forecast[0].low.fahrenheit); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload